Element can be click when out of view

WebDriver can't action the element when out of view

 

Webdriver can't action the element when the element is out of view

1. Scroll to the element

use javascript to scroll the element to view

((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", element);

2. Use Location to view

Use LocationInView property need use RemoteWebdriver and RemoteWebElement

Code like:

RemoteWebdriver rw = new RemoteWebdriver();
RemoteWebElement re = rw.FindelementOnPage(By.Id("id"));
re.LocationInView;

 

posted @ 2016-03-21 23:20  悟空救我呀  阅读(163)  评论(0编辑  收藏  举报