English 中文(简体)
如何选择在 Webdriver 中具有相同 cs 值的元素?
原标题:How to select an element among others all having same css value in webdriver?
  • 时间:2012-05-22 06:14:04
  •  标签:
  • webdriver

我有一个树结构, 它有可扩展的图标, 但都具有相同的 Cs 值。 我的目标是通过不同的行解析, 一旦我找到了想要的元素, 我将点击与之相关的可扩展图标 。

我能够剖析树, 并达到想要的元素。 但每当我试图点击使用 css 值的可扩展图像图标[让我们指出第 4 图标], 它总是选择第一个图标 。

问题回答

您可以使用 GetElements 而不是 GetElements, 然后通过收藏循环, 但似乎使用nth- child: http://www.w3schools.com/csref/sel_nth- child.asp http://www.w3schools.com/csref/sel_nth- child.asp 就可以更容易地解决这个问题。





相关问题
How to check if an element is visible with WebDriver

With WebDriver from Selenium 2.0a2 I am having trouble checking if an element is visible. WebDriver.findElement returns a WebElement, which unfortunately doesn t offer an isVisible method. I can go ...

How do I change the default request timeout for Selenium 2?

I am currently using Selenium 2.0a2 in Java to access the Internet using an HtmlUnitDriver instance. The problem I am facing is that, when I attempt to access slow websites, the request times out. How ...

WebRat+Selenium WebDriver: wait for ajax to be completed

We are running Webrat with Selenium2.0 aka WebDriver in our application. WebDriver handles page reloading very well and do not start next steps if the browser is reloading entire page. The problem is ...

How to delete Firefox cookies from webdriver in python?

when I can t delete FF cookies from webdriver. When I use the .delete_all_cookies method, it returns None. And when I try to get_cookies, I get the following error: webdriver_common.exceptions....

How to change firefox proxy from webdriver?

how can I access Firefox proxy settings from Python Webdriver and change them to make Firefox use modified proxy settings without needing to restart it?

热门标签