Firefox 我们如何使用Selenium+有效地点击链接;php#uwebdriver+;火狐?

Firefox 我们如何使用Selenium+有效地点击链接;php#uwebdriver+;火狐?,firefox,selenium,selenium-webdriver,Firefox,Selenium,Selenium Webdriver,我在使用Codeception+WebDriver+Selenium+Firefox的测试中遇到了很多问题,所以我决定从变量中删除Codeception,并直接使用php_WebDriver进行一些测试,以发现问题不在Codeception中 我尝试使用3种不同的方法进入页面: // Click a link $driver->findElement(WebDriverBy::id('inbox-navigation'))->click(); // Directly go to t

我在使用Codeception+WebDriver+Selenium+Firefox的测试中遇到了很多问题,所以我决定从变量中删除Codeception,并直接使用php_WebDriver进行一些测试,以发现问题不在Codeception中

我尝试使用3种不同的方法进入页面:

// Click a link
$driver->findElement(WebDriverBy::id('inbox-navigation'))->click();

// Directly go to the address via URL
$driver->get('http://testing.mysite.net/#/messages');

// Click via javascript
$driver->executeScript("jQuery('#inbox-navigation').click();");
当然,它们都不起作用,而且,在我的浏览器中手动操作,效果很好。链接显示为单击,url更改,但相关页面(通过ajax加载)从未加载

以下是我用来测试此功能的完整源代码:

<?php

require __DIR__."/vendor/autoload.php";

$host = 'http://localhost:4444/wd/hub';

$driver = RemoteWebDriver::create($host, DesiredCapabilities::firefox());

$driver->manage()->window()->setSize(new \WebDriverDimension(1280, 720));

$driver->get('http://testing.mysite.net/');

$driver->findElement(WebDriverBy::id('email'))->sendKeys('john@doe.com');
$driver->findElement(WebDriverBy::id('password'))->sendKeys('secret');
$driver->findElement(WebDriverBy::id('sign-in-button'))->click();

$driver->wait(10)->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::id('inbox-navigation')));

$driver->findElement(WebDriverBy::id('inbox-navigation'))->click();

sleep(15); /// to make sure it wasn't too fast

$driver->takeScreenshot('screen.png');

var_dump($driver->getCurrentURL());