【发布时间】:2020-07-28 04:49:41
【问题描述】:
我尝试了不同的 x 路径。
//*[@id='c635_container']
//div[@id='c635_container']
(//div[@class = 'select_container'])[16]
也尝试了这些,但它选择了两条路径。
//div[label[contains(text(),'Is there an interpreter or someone else speaking on the behalf of the customer?')]]//div[@class='select-container']
//div[(label[contains(text(),'Is there an interpreter or someone else speaking on the behalf of the customer?')])[1]]
//div[label[contains(text(),'Is there an interpreter or someone else speaking on the behalf of the customer?')] and //input[@class='select2-focusser select2-offscreen']][1]
//div[@class='select-container'] and //label[contains(text(),'Is there an interpreter or someone else speaking on the behalf of the customer?')] and //input[@class='select2-focusser select2-offscreen']]
//div[label[contains(text(),'Is there an interpreter or someone else speaking on the behalf of the customer?')]]
这个
//div[@class= ‘select_container’]
是所有下拉菜单的通用 XPath,并且 id 是动态的。所以,需要另想办法。
请检查链接:-
https://drive.google.com/file/d/1a96K2Zo7wOTZIHdBXLo_z-2WSO3T0b2R/view?usp=sharing
//div//label[text()='Is there an interpreter or someone else speaking on the behalf of the customer?'] and //div[@class='select-container']
这也行不通。
【问题讨论】:
-
可以给我们网址吗?
-
对不起!我无法将该 URL 共享为其高度安全的站点。
标签: java selenium selenium-webdriver xpath dropdown