use*_*669 5 php selenium phpunit selenium-webdriver
我在使用 php 时在 WebDriver 中触发按键事件有问题。有 class > test 元素在这个元素上通过 jquery 绑定按键。我尝试点击,但没有结果
$this->_city = $this->driver->findElement(WebDriverBy::className('test'));
$this->_city->click()
Run Code Online (Sandbox Code Playgroud)
请帮助我,谁知道如何使用 php 在 webdriwer 上模拟按键。
$this->_city = $this->driver->findElement(WebDriverBy::className('test'));
$this->_city->click()
$this->driver->getKeyboard()->sendKeys('TEXT HERE'); // this will insert text in the box
$this->driver->getKeyboard()->pressKey(WebDriverKeys::ENTER); // This will do a enter or whatever key you like to press ( not letter/numbers move ARROW_UP or whatever you like to presskey)
Run Code Online (Sandbox Code Playgroud)
以下是驱动程序的其他一些键:
小智 0
您提到了按键事件,那么您正在寻找键盘上被按下的某种类型的按键?使用 click() 事件模拟鼠标单击相关元素。一旦元素获得焦点,您可能需要使用 sendKeys() 函数。
$this->_city = $this->driver->findElement(WebDriverBy::className('test'));
$this->_city->click()
$this->_city->sendKeys('A');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7391 次 |
| 最近记录: |