码迷,mamicode.com
首页 > Web开发 > 详细

关于页面元素不能定位,通过Js进行处理

时间:2017-09-26 13:03:22      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:doc   rgs   --   app   row   new   webdriver   public   onclick   

public class Test {
public static void main(String[] args) throws Exception {
File file = new File("C:\\Users\\HP\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\y0iw24je.default");
FirefoxProfile profile = new FirefoxProfile(file);
WebDriver driver = new FirefoxDriver(profile);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
................................................
WebElement element = driver.findElement(By.cssSelector("select[id=‘programType‘]"));
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("document.getElementById(‘programType‘).value=‘1‘");
js.executeScript("document.getElementById(‘orderStatus‘).value=‘PASS,SUPPLY‘");
js.executeScript("document.getElementById(‘queryBtn‘).click()");--js实现点击世间onclick()/click
Thread.sleep(3000);
}
}

关于页面元素不能定位,通过Js进行处理

标签:doc   rgs   --   app   row   new   webdriver   public   onclick   

原文地址:http://www.cnblogs.com/jackyu126/p/7595861.html

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