2019.12.18
Chrome浏览器
System.setProperty(“webdriver.chrome.driver”, “D:\Autotools\chromedriver79\chromedriver.exe”);
WebDriver driver=new ChromeDriver();
报错:
Exception in thread “main” java.lang.Error: Unresolved compilation problems:
WebDriver cannot be resolved to a type
ChromeDriver cannot be resolved to a type
at com.testing.Lagou.LagouTest.main(LagouTest.java:10)
解决:未导入jar包——快捷键ctrl+shift+o
2019.12.19
//打开拉勾网
driver.get(“https://www.lagou.com/”);
//元素定位
//classname 中如果带上了空格,没法直接用该方法定位
driver.findelement(by.classname(“tab focus”)).click();//报错no such element: Unable to locate element: {“method”:“css selector”,“selector”:".tab\ focus"}
driver.findelement(by.linktext(“全国站”)).click;
//输入软件测试
driver.findelement(by.id(“search_input”)).sendkeys(“软件测试”);
//点击搜索按钮
driver.findelement(by.id(“search_b