Python 按父类和子文本查找元素
我有如下所示的web元素 需要单击元素“class=dxnb gr”,子元素有文本“Leave details” 将给出具有给定类的第一个元素Python 按父类和子文本查找元素,python,xpath,selenium-webdriver,Python,Xpath,Selenium Webdriver,我有如下所示的web元素 需要单击元素“class=dxnb gr”,子元素有文本“Leave details” 将给出具有给定类的第一个元素 //*[(contains(text()='Leave Details')] 会给孩子一些零散的文字 我如何结合这些条件 尝试使用此xpath: .//li[@class='dxnb-gr' and descendant::*[contains(text(),'Leave Details')]] 尝试使用此xpath: .//li[@class=
//*[(contains(text()='Leave Details')]
会给孩子一些零散的文字
我如何结合这些条件 尝试使用此xpath:
.//li[@class='dxnb-gr' and descendant::*[contains(text(),'Leave Details')]]
尝试使用此xpath:
.//li[@class='dxnb-gr' and descendant::*[contains(text(),'Leave Details')]]
xpatH,用于
dxnb gr
,其中包含特定文本的元素:
//*[@class='dxnb-gr'][.//*[contains(.,'Leave Details')]]
包含特定文本元素的
dxnb gr
的xpatH:
//*[@class='dxnb-gr'][.//*[contains(.,'Leave Details')]]
请突出显示元素是否尝试此
驱动程序。通过xpath(“./*[@class='dxnb-gr']和contains(text()='Leave Details')]”查找元素共享URL请突出显示元素是否尝试此驱动程序。通过xpath(./*[@class='dxnb-gr']和contains(text()='Leave Details'))查找元素
请共享URL您能看到我添加的图像吗?它对我有用。你能看到我添加的图像吗?它对我有用。你如何实现精确文本?“//*[@class='dxnb-gr'][.text()='Leave Details']不起作用。在xml中,末尾有空格,这很重要吗?如何实现精确文本?”//*[@class='dxnb-gr'][.text()='Leave Details']不起作用。在xml中,末尾有空格,这是否重要?