揭开WebDriver面纱
经过一段时间的磨合,决定把WebDriver应用到实际项目中,写一个下单的脚本,途中也算是经历了些风雨,希望能见彩虹。 一、在Eclipse中安装TestNG 使用在线安装总是不成功,到官网下载安装包又提示没有权限,折腾了好几天,终于在网上找了个能用的安装包,安装成功。 二、报cannot instantiate the type select 脚本中本来是用select来找到下拉框的,可是却一直报这个错,后来才发现是少了个报,import就行了org.openqa.selenium.support.ui.Select 三、Element is not currently visible and so may not be interacted with Command duration or timeout: 10.09 seconds 下拉框总是找不到元素,发现项目是鼠标停留就可以出现选项的,使用了鼠标停留的方法,成功找到 Actions builder1 = new Actions(driver); builder1.moveToElement(driver.findElement(By.xpath("//*[@id='order_step2']/div[2]/table/tbody/tr[3]/td[2]/div/div"))); driver.findElement(By