Python 如何在下面的树中找到满足条件的元素?
使用Python和Selenium如何在下面的树中找到满足条件的元素 (S,A~H为类)Python 如何在下面的树中找到满足条件的元素?,python,selenium,class,Python,Selenium,Class,使用Python和Selenium如何在下面的树中找到满足条件的元素 (S,A~H为类) 当D存在时,我们希望找到F的元素。如果s是webelement根,我们希望检查该元素中是否存在类,我们将执行以下操作 elem=s.find_element_by_xpath("//[class='c']/[class='d']") if elem: s.find_element_by_xpath("//[class='e']/[class='f']") 是|
当D存在时,我们希望找到F的元素。如果s是webelement根,我们希望检查该元素中是否存在类,我们将执行以下操作
elem=s.find_element_by_xpath("//[class='c']/[class='d']")
if elem:
s.find_element_by_xpath("//[class='e']/[class='f']")
是|还是在这种情况下?
elem=s.find_element_by_xpath("//[class='c']/[class='d']")
if elem:
s.find_element_by_xpath("//[class='e']/[class='f']")