Py学习  »  Python

Senium Python:理解对“rect”类型元素的访问

Dick_Grayson • 6 年前 • 2173 次点击  

dom中有一个rect对象:

<rect class="slv-blank" id="id123" height="8.8" stroke-width="1px" width="18.8" x="59.2" y="37.5"></rect>

我试图用以下代码搜索它:

WebDriverWait(driver, 1).until(ec.presence_of_element_located(("xpath", '//rect[@id="id123"]'))).click()

这不起作用。

但以下是:

WebDriverWait(driver, 1).until(ec.presence_of_element_located(("xpath", '//*[name()="rect"][@id="id123"]'))).click()

关于第一个为什么不起作用有什么线索吗?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/54071
文章 [ 2 ]  |  最新文章 6 年前