2016-09-14 3 views
0

Ich muss eine Checkbox namens Standards,Selenium webdriver Brauchen Sie eine Checkbox zu überprüfen

überprüfen, siehe Screenshot.

enter image description here

konnte ich die information type Dropdown erweitern über:

By.xpath("//div[contains(@class, 'expand') and h3[contains(text(), 'Information Type')]]") 
+0

konnte ich den Informationstyp Drop-Down über erweitern: By.xpath ("// div [enthält (@class, 'erweitern') und h3 [enthält (text(),‚Information Typ ')]] ") – Tony

Antwort

1

Nach Information Type Element erweitern Sie bis Standards Kontrollkästchen Element immer sichtbar und anklickbar mit WebDriverWait wie unten warten soll: -

new WebDriverWait(driver,10).until(ExpectedConditions.elementToBeClickable(By.xpath(".//li[normalize-space(.)='Standards']/input"))).click(); 

Sie können auch dieseverwendensowie:

.//li[contains(.,'Standards')]/input 
+1

Ja, funktioniert. Du bist ein Genie. – Tony

+0

Hallo, kannst du etwas mehr über den XPath-Ausdruck erklären: .//li_normalize-space(.)='Standards']/input? Ich bin ein bisschen verloren. Warum brauchst du am Ende? Danke – Tony

+0

Auch warum brauchst du .// statt // an der Front? – Tony

Verwandte Themen