2015-02-23 103 views
0

複選框標籤存在內標籤與使用方面我不能點擊複選框,因爲沒有目前該複選框

<label class="field-item-header" for="fragment-1996782958_acceptAgreement"> 
I agree to the 
<a target="_blank" href="example.com/terms-of-use">Terms of Use.</a> 
</label> 

以前我能點擊複選框的鏈接,但現在它的點擊在使用

方面的鏈接我用下面的XPath來定位複選框

I_AGREE_CHECKBOX = By.xpath("//div[@class='account-information']/fieldset[2]/ul/li[2]/span[1]/label"); 

I_AGREE_CHECKBOX = By.xpath("//*[contains(text(), 'I agree to the')]"); 

請給我一些想法,這樣我可以在複選框上的使用條款的事先單擊不但不 感謝

+0

下標籤上只有一個標籤。你確定你在這裏提供正確的html代碼片段嗎?請重新檢查。 – 2015-02-23 10:39:51

回答

0

嘗試使用下面的表達式:

//*[text()[contains(.,'I agree to the'))]] 
+0

我已經使用了您提供的xpath //*[text()[contains(.,'我同意')]]它仍然點擊鏈接使用條款鏈接 – stest 2015-02-23 10:33:42

+0

您可以分享您正在使用的網址嗎? – aberna 2015-02-23 11:34:12

+0

我不能分享它的機密 – stest 2015-02-23 11:44:47