码迷,mamicode.com
首页 > 其他好文 > 详细

Element can be click when out of view

时间:2016-03-22 00:20:52      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:

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;

 

Element can be click when out of view

标签:

原文地址:http://www.cnblogs.com/lgm1999/p/5304305.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!