2017-04-10 37 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()