Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/387.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Selenium Chromedriver:Android上没有这样的窗口异常_Java_Selenium_Selenium Webdriver_Selenium Chromedriver - Fatal编程技术网

Java Selenium Chromedriver:Android上没有这样的窗口异常

Java Selenium Chromedriver:Android上没有这样的窗口异常,java,selenium,selenium-webdriver,selenium-chromedriver,Java,Selenium,Selenium Webdriver,Selenium Chromedriver,我是appium框架的新手 @Test @Parameters("fileName_attachment_TC1") public void TC001_verifyNavSyncfromContinousToDynamic(String fileName_TC1) throws InterruptedException, IOException { homeUtils.openFileViaFABInRecents(fileName_TC1, HomeConst.t

我是appium框架的新手

    @Test
@Parameters("fileName_attachment_TC1")
public void TC001_verifyNavSyncfromContinousToDynamic(String 
 fileName_TC1) throws InterruptedException, IOException
{
   homeUtils.openFileViaFABInRecents(fileName_TC1, 
    HomeConst.txt_saf_sideMenu_internalStorage);
    //homeUtils.openFileFromRecentByInstance(2);
    Thread.sleep(4000);
    viewerUtilsInst.dismissDynamicViewCoachmark();
    viewerUtils.selectViewMode("Continuous Scroll");
    viewerUtils.dismissScrubberFirstTimeExperience();
    driver.swipe(440, 1000, 440, 5, 3000);
    driver.swipe(440, 1150, 440, 5, 3000);
    viewerUtils.selectViewMode("Dynamic View");
    try{
        commonUtils.switchContextToWebView();
        String awe1=driver.getWindowHandle();
        String java = "return 
        window.document.getElementById('adbe_id_46')";
        String rect = java+".getBoundingClientRect().top";
        JavascriptExecutor js = (JavascriptExecutor) driver; 
        Double distFrmTop = (Double) js.executeScript(rect);
        System.out.println("distFrmTop:"+distFrmTop);
        Assert.assertTrue( distFrmTop < 0.8);
    }
    catch(Exception e)
    {
        System.out.println("Exception in 
                 TC001_verifyNavSyncfromContinousToDynamic");
    }
    commonUtils.switchContextToNativeApp();
    commonUtils.pressHBB();

}

@Test
@Parameters("fileName_attachment_TC2")
public void TC002_verifyNavSyncfromDynamicToContinous(String fileName_TC1) throws InterruptedException, IOException
{
    commonUtils.switchContextToNativeApp();
    homeUtils.openFileViaFABInRecents(fileName_TC1, HomeConst.txt_saf_sideMenu_internalStorage);
    //homeUtils.openFileFromRecentByInstance(2);
    Thread.sleep(4000);
    viewerUtilsInst.dismissDynamicViewCoachmark();
    try{
        commonUtils.switchContextToWebView();
        Thread.sleep(4000);
        String awe=driver.getWindowHandle();
        WebElement ele = driver.findElement(By.xpath("//*[(@id='adbe_id_112')]"));
        commonUtils.scrollinDynamicView(ele);
        commonUtils.switchContextToNativeApp();
        viewerUtils.selectViewMode("Continuous Scroll");
        viewerUtils.dismissScrubberFirstTimeExperience();
        commonUtils.tapOnScreen(200, 200);
        Assert.assertTrue(commonUtils.compareScreenshot());
    }
    catch(Exception e)
    {
        System.out.println("Exception in TC002_verifyNavSyncfromDynamicToContinous");
    }
    finally{
        commonUtils.pressHBB();     
    }
}

如何关闭新窗口并切换回原始窗口并与之交互?

请阅读并提供您尝试的代码和执行结果,包括任何错误消息,等等@JeffC我已经用代码更新了问题,请阅读并提供您尝试过的代码和执行结果,包括任何错误消息等@JeffC我也用代码更新了问题
no such window: window was already closed
  (Session info: chrome=57.0.2987.132)
  (Driver info: chromedriver=2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.12.2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 42 milliseconds