[英]How to identify multiple parameters using cssSelector in Selenium webdriver
谁能说出如何识别selenium webdriver
的以下元素。 以下是它的html
版本:
<select ng-model="tripDetails.destinationId" ng-change="$parent.$parent.$parent.updateTripSourceCity($index)" required="" class="ng-touched ng-dirty ng-valid-parse ng-valid ng-valid-required">
尝试使用以下CSS
选择器通过类名标识它
select.ng-touched.ng-dirty.ng-valid-parse.ng-valid.ng-valid-required
我猜想这个类不是唯一的,所以最好通过ng-model
选择。 尝试将其作为CSS选择器:
'select[ng-model="tripDetails.destinationId"]'
在您的情况下,最好使用xpath搜索该特定元素。 首先使用上面提到的元素的层次结构中上方的xpath搜索任何父元素,然后从该父元素中搜索您的元素。 试试这个
//parent-xpath/child-xpath(mentioned element)
//div[@id='element-id']/select[@ng-model='tripDetails.destinationId']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.