0

I'm writing tests using Selenium WebDriver. While tests run, I want to know which element is being interacted. This can be achieved by highlighting that element before performing any action on that element. Is there any Selenium WebDriver api (for Ruby) available to achieve this?

4

1 回答 1

1

我可以为此找到解决方案。以下是使用javascript的方式,我们可以突出显示元素:

driver.execute_script("arguments[0].setAttribute('style', arguments[1]);", element, "color: yellow; border: 2px solid yell>

以下是从中删除突出显示:

driver.execute_script("arguments[0].setAttribute('style', arguments[1]);", height, "")
于 2013-08-05T11:48:37.763 回答