2017-04-10 39 views
-1

我想選擇以下(第4行)已TD文本=「預定」和TD文本=「QA測試CHIRAG」選擇含有連續兩個不同的TD文本

enter image description here

行這是我到目前爲止,這種選擇具有文本QA測試CHIRAG該行並單擊相鄰的打開按鈕:

self.driver.find_element_by_xpath("//tr/td[text()='QA TEST CHIRAG']/./../td/input[@type='Button' and @value = 'Open']").click() 

我想知道我怎麼能有文字安排檢查行和QA TEST CHIRAG,然後點擊打開按鈕

+1

'// TR [TD [文本()= 'QA測試CHIRAG']和TD [文本()= 「預定」] ]/td/input [@ type ='Button'and @value ='Open']' – splash58

回答

1

你寫了一個說這個的xpath。

find an element whose text="QA TEST CHIRAG" > find a sibling td> 
select input elment inside it. 

你可以用這樣的話來擴展它。

Select td with text=Scheduled > find sibling element with text="QA TEST CHIRAG" > find sibling td > select input element inside it. 

換句話說,你可以試試這個XPath:

self.driver.find_element_by_xpath("//tr/td[text()='Scheduled']/./../td[text()='QA TEST CHIRAG']/./../td/input[@type='Button' and @value = 'Open']").click()