Html 从Selenium中的下拉列表中选择
我是selenium的新手,我正在尝试从下拉列表中选择一个选项。以下是下拉列表的HTML:Html 从Selenium中的下拉列表中选择,html,selenium,selenium-webdriver,Html,Selenium,Selenium Webdriver,我是selenium的新手,我正在尝试从下拉列表中选择一个选项。以下是下拉列表的HTML: <input type="text" ng-blur="getInventoryStatus()" typeahead-on-select="onDeviceSelect($item)" typeahead="device as device.name for device in deviceList| filter:$viewValue |orderBy:'name':false"
<input type="text" ng-blur="getInventoryStatus()"
typeahead-on-select="onDeviceSelect($item)"
typeahead="device as device.name for device in deviceList| filter:$viewValue |orderBy:'name':false"
ng-model="deviceSearch" placeholder="SKU / Item Name" class="form-control
ng-pristine ng-valid" autocomplete="off" aria-autocomplete="list"
aria-expanded="false" aria-owns="typeahead-00F-1916">
我已经尝试了几乎所有的方法,我可以在互联网上找到,但没有工作。
我试图使用Select
类,包装了WebElement
,但它抛出了一个异常nosucheelement
我试图丢失列表中的所有选项,但在这种情况下得到了异常ui。意外的TagNameException.Element
应该有标记Select
,但它有输入
。我需要使用xpath
作为findelements的标识符
请在这方面帮助我。如果下拉元素是可编辑字段,则此操作有效:
driver.findElement("dropdown rlement").sendKeys("your value");
这里没有HTML。我也有这些问题,但现在记不起解决方案了。尝试使用javascript
jQuery。单击()选择选项。选择“不起作用”。请检查findElement(By.xpath(//input[@placeholder='SKU/Item Name'])
是否返回一个元素?findElement(By.xpath(//…)在我能够单击该元素时返回该元素@维维克辛汉克斯。这很好用。Sendkeys您所需的值,所需的值显示在下拉列表中。现在只需单击下拉列表中的选项。非常感谢:)
driver.findElement("dropdown rlement").sendKeys("your value");