Can anyone tell how to identify the following element in selenium webdriver
. Following is the html
version of it :
<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
I'm guessing the classes on this are not unique, so it would probably be best to select by the ng-model
. Try this as the CSS selector:
'select[ng-model="tripDetails.destinationId"]'
In your case it is better to search that particular element using xpath. First search any parent element using xpath which is above in hierarchy of the above mentioned element and then from that parent search your element. Try something like this
//parent-xpath/child-xpath(mentioned element)
//div[@id='element-id']/select[@ng-model='tripDetails.destinationId']
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.