python的behat/mink硒抽象层?

2024-09-29 07:30:39 发布

您现在位置:Python中文网/ 问答频道 /正文

所以在PHP世界中,有一个抽象层可以使用,称为Mink,它运行在selenium之上,它提供了比纯selenium webdriver更好的界面。下面是一个示例:

// set the default session name
$mink->setDefaultSessionName('goutte2');

// visit a page
$mink->getSession()->visit($startUrl);

// call to getSession() without argument will always return a default session if has one (goutte2 here)
$mink->getSession()->getPage()->findLink('Downloads')->click();
echo $mink->getSession()->getPage()->getContent();

在Python世界中有类似的项目吗?我的googlefu没什么进展。它不一定非得是一个测试框架,我想用它来做一些信息提取,而不必直接编写webdriver代码。在


Tags: default示例界面sessionselenium世界visitphp
2条回答

^{}声称是一个:

Splinter is an abstraction layer on top of existing browser automation tools such as Selenium, PhantomJS and zope.testbrowser. It has a high-level API that makes it easy to write automated tests of web applications.

您可以尝试使用Robot Framework来获得一个真正高级的接口。它内部是Python,但基本上可以用于任何语言/环境。在

相关问题 更多 >