51Testing软件测试论坛
标题: 脚本运行到“密码安全”时报错无法继续执行 [打印本页]
作者: OM23 时间: 2018-3-13 14:27
标题: 脚本运行到“密码安全”时报错无法继续执行
脚本运行到“密码安全”时报错,无法继续执行,如果将“密码安全”换成“隐私筛选”或“访问推广”,脚本均可继续运行,这是什么原因呢?
以下是脚本:
package selenium0228;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
//import org.openqa.selenium.ie.InternetExplorerDriver;
//import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class helloTest {
public static void main(String[] args) {
System.out.println("Say hello toWebdriver!");
System.setProperty("webdriver.chrome.driver","c:\\browserdriver\\chromedriver.exe");
WebDriver dr=new ChromeDriver();
//System.setProperty("webdriver.gecko.driver","c:\\browserdriver\\geckodriver.exe");
//WebDriver dr=new FirefoxDriver();
//System.setProperty("webdriver.ie.driver", "c:\\browserdriver\\IEDriverServer.exe");
//WebDriver dr=newInternetExplorerDriver();
dr.get("http://localhost:8082/upload/forum.php");
dr.findElement(By.id("ls_username")).sendKeys("admin");
dr.findElement(By.id("ls_password")).sendKeys("111111");
dr.findElement(By.cssSelector("button.pn.vm")).click();
dr.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
//try {
//Thread.sleep(3000);
//}catch(InterruptedException e) {
// e.printStackTrace();
//}
dr.findElement(By.linkText("设置")).click();
dr.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
dr.findElement(By.linkText("访问推广")).click();
dr.findElement(By.linkText("密码安全")).click();
//dr.findElement(By.linkText("密码安全")).click();
//dr.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
//System.out.println("Say hello toWebdriver!");
//dr.findElement(By.id("oldpassword")).clear();
//dr.findElement(By.id("oldpassword")).sendKeys("111111");
//dr.findElement(By.id("newpassword")).clear();
//dr.findElement(By.id("newpassword")).sendKeys("111111");
//dr.findElement(By.id("newpassword2")).clear();
//dr.findElement(By.id("newpassword2")).sendKeys("111111");
//dr.findElement(By.linkText("保存")).click();
//dr.findElement(By.name("pwdsubmit")).click();
dr.quit();
}
}
以下是Console中的内容:
Say hello toWebdriver!
Starting ChromeDriver 2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9) onport 30526
Only local connections are allowed.
二月 28, 2018 3:52:55 下午org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Exception in thread "main" org.openqa.selenium.WebDriverException:unknown error: cannot determine loading status
from unknown error: missing or invalid 'entry.level'
(Session info: chrome=63.0.3239.132)
(Driver info: chromedriver=2.27.440174(e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 10.0.14393x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 521 milliseconds
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52-0800'
System info: host: 'YBAO-9480-SHA', ip: '10.94.9.213', os.name: 'Windows 10',os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false,mobileEmulationEnabled=false, networkConnectionEnabled=false,chrome={chromedriverVersion=2.27.440174(e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),userDataDir=C:\Users\ybao\AppData\Local\Temp\scoped_dir14428_28564},takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false,handlesAlerts=true, hasTouchScreen=false, version=63.0.3239.132, platform=XP,browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true,locationContextEnabled=true, webStorageEnabled=true, browserName=chrome,takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true,unexpectedAlertBehaviour=}]
Session ID: 1e92b96e838c87839c90e5940098aa05
atsun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
atsun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
atsun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
atjava.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
atorg.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
atorg.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:638)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:274)
atorg.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
at selenium0228.helloTest.main(helloTest.java:33)
上传了附件,麻烦老师给看下吧~
在学课程
Selenium自动化测试通关课程
http://www.atstudy.com/course/270
-
-
代码及错误.docx
15.23 KB, 下载次数: 15
作者: 学掌门网校 时间: 2018-3-13 15:30
通过错误的log,只捕获到了一个有用信息:missing or invalid 'entry.level',这个问题很多网友都遇到了,在附件里面。你先尝试一下
-
-
QQ截图20180228171416.rar
9.44 KB, 下载次数: 18
作者: OM23 时间: 2018-3-13 16:54
再问下,图里的路径打不开,下载最新的chrome driver也没解决这个问题。这个对chrome的版本是不是有什么要求?
作者: 学掌门网校 时间: 2018-3-13 16:55
chrome和chromedriver的版本要匹配。
我给你个分享,里面的软件和驱动我自己都试过,都是匹配的。
链接:https://pan.baidu.com/s/1kXaNsDx 密码:fism
chromedriver给了两个,两个都试一下
作者: OM23 时间: 2018-3-14 13:30
谢谢
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) |
Powered by Discuz! X3.2 |