<label class="control-label">
Rental Charge:
<span class="required" ng-show="vm.rentalInfo.reason">* (Min of $30.00)</span>
</label>
所有的文字我用硒的webdriver的Python:我似乎无法找到一个标签标记
driver.find_element_by_xpath("//label[@ class = 'control-label']/span[@class = 'required']").text
和唯一的text
我回来是asterisk *
,不显示(Min of $30.00)
。 有谁知道这是为什么?
你确定两个文本存在于同一个'span'里吗?或者你的定位器是唯一的? –
这个定位器太宽了,你可能会匹配一个不同的元素。尝试让你的定位器更具体,例如:''driver.find_element_by_css_selector('span [ng-show * =“rentalInfo.reason”]')' – alecxe
@Saurabh Gaur,html与我的描述完全一致。 – Tosyneno