gpt4 book ai didi

Selenium:org.openqa.selenium.NoSuchWindowException:当前聚焦的窗口已关闭

转载 作者:行者123 更新时间:2023-12-04 09:38:55 27 4
gpt4 key购买 nike

  • System.setProperty(“webdriver.ie.driver”,“D:\Selenium\jars\IEDriverServer\IEDriverServer.exe”);
  • WebDriver驱动程序=新的InternetExplorerDriver();
  • driver.manage()。timeouts()。implicitlyWait(30,TimeUnit.SECONDS);
  • driver.get(“http://the-internet.herokuapp.com”);
  • driver.findElement(By.linkText(“忘记密码”))。click();
  • Thread.sleep(3000);
  • driver.findElement(By.id(“email”))。sendKeys(“testmail@mail.com”);

  • 当我运行上面的代码时,它可以与chrome和firefox正常工作,但是当我使用IE运行时,在运行第7步时却抛出了以下错误消息,原因是它在IE中无法正常工作。

    能否有人帮助我解决此问题。预先感谢

    2017年11月20日2:58:39 PM org.openqa.selenium.remote.ErrorCodes toStatus
    信息:HTTP状态:'404'->“无此窗口”的JSON状态映射不正确(预期为400)

    org.openqa.selenium.NoSuchWindowException:当前聚焦的窗口已关闭。
    构建信息:版本:'3.6.0',修订版:'6fbf3ec767',时间:'2017-09-27T15:28:36.4Z'
    系统信息:主机:'ML-SIVAKUMARS-P',ip:'192.168.12.159',操作系统名称:'Windows 7',os.arch:'amd64',os.version:'6.1',java.version: '1.8.0_121'
    驱动程序信息:org.openqa.selenium.ie.InternetExplorerDriver
    功能[{proxy = Proxy(),acceptInsecureCerts = false,browserVersion = 11,se:ieOptions = {nativeEvents = true,browserAttachTimeout = 0,即ensureCleanSession = false,elementScrollBehavior = 0,enablePersistentHover = true,即browserCommandLineSwitches =,即.forceCreateProcessApi = false,requireWindowFocus = false,initialBrowserUrl = http://localhost:2761/,ignoreZoomSetting = false,即.fileUploadDialogTimeout = 3000,ignoreProtectedModeSettings = false},超时= {implicit = 0,pageLoad = 300000,脚本= 30000},浏览器名称=互联网浏览器,pageLoadStrategy = normal,javascriptEnabled = true,platformName = WINDOWS,setWindowRect = true,platform = WINDOWS}]
    session ID:24a4d291-482e-4399-98fc-f2037c4da5bb
    ***元素信息:{Using = id,value = email}
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:185)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:120)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:356)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:402)
    at org.openqa.selenium.By$ById.findElement(By.java:218)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:348)
    at com.org.learning.tests.TestDayTwo.firstTest(TestDayTwo.java:38)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
    at org.testng.TestRunner.privateRun(TestRunner.java:744)
    at org.testng.TestRunner.run(TestRunner.java:602)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
    at org.testng.SuiteRunner.run(SuiteRunner.java:289)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
    at org.testng.TestNG.runSuites(TestNG.java:1144)
    at org.testng.TestNG.run(TestNG.java:1115)
    at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
    at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)

    最佳答案

    从昨天开始,我一直在同一个问题上挣扎,终于让我的测试工作了。
    检查是否具有InternetExplorerDriver的所有required configurations。对我来说,即使在Win 10上,我也最终测试了保护模式设置。
    希望它也对您有帮助。

    关于Selenium:org.openqa.selenium.NoSuchWindowException:当前聚焦的窗口已关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47388733/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com