Perl Can';t使用Selenium远程驱动程序启动浏览器
我不知道为什么,但我无法使用下面的代码启动浏览器。我正在eclipse上使用EPIC。我已经为此安装了所需的selenium模块 当我运行下面提到的代码:“无法连接到C:/ProgramFiles/Perl/site/lib/Selenium/Remote/Driver.pm第220行的SeleniumWebDriver”时,我遇到了这个错误 感谢您的帮助 这是我的密码:Perl Can';t使用Selenium远程驱动程序启动浏览器,perl,selenium,Perl,Selenium,我不知道为什么,但我无法使用下面的代码启动浏览器。我正在eclipse上使用EPIC。我已经为此安装了所需的selenium模块 当我运行下面提到的代码:“无法连接到C:/ProgramFiles/Perl/site/lib/Selenium/Remote/Driver.pm第220行的SeleniumWebDriver”时,我遇到了这个错误 感谢您的帮助 这是我的密码: 使用Selenium::Remote::Driver my $driver = new Selenium::Remote:
使用Selenium::Remote::Driver
my $driver = new Selenium::Remote::Driver(browser_name => 'firefox', port => 5555,
platform => 'WINDOWS');
$driver->get('http://www.google.com');
print $driver->get_title();
$driver->quit();
Charles,我的电脑已更新为新的Java版本,因此我的服务器启动文件无法启动服务器。我用正确的java路径更正了启动文件,它启动了浏览器
但我不知道为什么它会显示空白页面,因为它应该打开google.com它可能会在你注意到它之前关闭页面?此外,我认为selenium侦听的端口号默认为
4444
试试这个:
use Selenium::Remote::Driver;
my $driver = new Selenium::Remote::Driver(browser_name => 'firefox', port => 4444,
platform => 'ANY',);
$driver->get('http://www.google.com');
sleep(200);
print $driver->get_title(),"\n";
$driver->quit();
我将Selenium版本改为2.31,它成功了。之前我使用的是与FF 19不兼容的2.28,在运行应该启动远程服务器的代码之前。 在系统中退出chrome驱动程序和jar文件的路径如下所示,然后 转到命令提示符并运行以下命令-请 java-Dwebdriver.chrome.driver=“\Enter folder path\chromedriver.exe”-jar\Enter folder path\selenium-server-standalone-2.53.0.jar 如果您使用的是Firefox,请编写以下代码。 my$driver=Selenium::Remote::driver->new() 对于chrome用户:
我的$driver=Selenium::Remote::driver->new(浏览器名称=>'chrome') selenium是否正在本地主机的端口5555上积极侦听?该错误意味着您的程序找不到selenium服务器。如何确保它正在侦听端口5555?如果我的程序找不到selenium服务器,是与权限问题有关,还是提到的路径对perl是错误的。我找到了原因,但现在我不知道为什么它会显示空白页,因为它应该打开google.com。我将selenium版本更改为2.31,并且它工作了。之前我使用的是与FF 19不兼容的2.28