用百度新闻来试 webview 的测试。遇到以下问题。以及我的问题,求大神解答:
1、webview 只能通过 selendroid 模式来测试么?
2.、selendroid 模式下不能注释 App 路径么,每次都必须安装?
3、以下是我目前遇到的问题:
Proxied response received with status 500: undefined

debug: Request received with params: {"name":"WEBVIEW"}
debug: Proxying command to localhost:8080
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/ba7a390c-e
02f-48f3-98db-03cd3a9ed3b7/window","method":"POST","json":{"name":"WEBVIEW"}}
debug: Proxied response received with status 500: undefined
POST /wd/hub/session/ba7a390c-e02f-48f3-98db-03cd3a9ed3b7/window 500 5240ms
debug: Appium request initiated at /wd/hub/session/ba7a390c-e02f-48f3-98db-03cd3a9ed3b7
debug: Request received with params: {}

代码如下:

private WebDriver driver;
    @Before
    public void setUp() throws Exception {
        // set up appium
      File classpathRoot = new File(System.getProperty("user.dir"));
       File appDir = new File(classpathRoot, "apps/baidu");
       File app = new File(appDir, "com.baidu.news_debug.apk");
        DesiredCapabilities capabilities = new DesiredCapabilities();
       //capabilities.setCapability("device","Android");
        capabilities.setCapability("device","Selendroid");
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
        capabilities.setCapability(CapabilityType.VERSION, "4.3");
        capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS");
        capabilities.setCapability("app", app.getAbsolutePath());
        capabilities.setCapability("app-package", "com.baidu.news");
        capabilities.setCapability("app-activity", ".ui.ColdStartActivity");
        capabilities.setCapability("newCommandTimeout", "200");
        URL url = new URL("http://127.0.0.1:4723/wd/hub");
        driver = new RemoteWebDriver(url, capabilities);
    }
       @Test
        public void testContact(){
          driver = new Augmenter().augment(driver);
          driver.switchTo().window("WEBVIEW");
          driver.findElement(By.name("IT人")).click();
          driver.findElement(By.name("立即体验")).click();
          try{
                Thread.sleep(5000);
            }catch(Exception e){
                e.printStackTrace();
            }
      }


↙↙↙阅读原文可查看相关链接,并与作者交流