xpath 获取当前节点的父节点,兄弟节点的方法

xpath_input_exp_mark = '//label[contains(text(), "文本内容")]/../following-sibling::div[1]//input'

browser.find_element_by_xpath(xpath_input_exp_mark)

.. 表示当前节点的父节点

following-sibling::div[1] 表示当前节点的兄弟节点中的 第 1 个 div标签

猜你喜欢

转载自blog.csdn.net/heatdeath/article/details/72236492