ericmckean / chromedriver

Automatically exported from code.google.com/p/chromedriver
0 stars 0 forks source link

WebDriverException: unknown error: cannot activate web view #1008

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
See http://goo.gl/ll2FvQ for common issues.

Issue Description:
I'm automating tests for a hybrid app with appium and I'm using the latest 
chromedriver 2.13.
In my tests I want to switch from the native view to webview and vice versa, 
depending on the elements I want to interact with. 

Before the latest version of chromedriver, I was unable to switch to the 
webview. Now, with the fix for issue 845 I'm able to switch to the webview, but 
If I switch to native view and then back to the webview, the chromedriver is 
unable to  find the requested element.
The first time I switch to the webview everything works fine. If I switch to 
native view and back, then it seems that the webview doesn't get updated.
During teardown it fails with: WebDriverException: unknown error: cannot 
activate web view

org.openqa.selenium.WebDriverException: unknown error: cannot activate web view
  (Session info: webview=)
  (Driver info: chromedriver=2.13.307650 (feffe1dd547ee7b5c16d38784cd0cd679dfd7850),platform=Mac OS X 10.9.5 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 7 milliseconds
Build info: version: '2.43.1', revision: 
'5163bceef1bc36d43f3dc0b83c88998168a363a0', time: '2014-09-10 09:43:55'
System info: host: 'bb-MacBook-Pro-7.local', ip: '10.10.15.176', os.name: 'Mac 
OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_71'
Session ID: 4d581bc2-df3c-4a75-94a0-2e1daf1fc3fd
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{automationName=Appium, platform=LINUX, 
app=/Users/.../Documents/Mobile/AppFiles/Android/BB.apk, 
javascriptEnabled=true, appActivity=.BBActivity, browserName=Android, 
networkConnectionEnabled=true, desired={automationName=Appium, 
app=/Users/.../Documents/CXPMobile/AppFiles/Android/mobile.apk, 
platformVersion=4.4.4, deviceName=Google Nexus 5 - 4.4.4 - API 19 - 1080x1920, 
platformName=Android, appActivity=.BBActivity, appPackage=com.bb.mobile}, 
locationContextEnabled=false, appPackage=com.bb.mobile, platformVersion=4.4.4, 
databaseEnabled=false, deviceName=Google Nexus 5 - 4.4.4 - API 19 - 1080x1920, 
platformName=Android, webStorageEnabled=false, warnings={}, 
takesScreenshot=true}]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:185)
    at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:324)
    at com.bb.tools.mobileautomation.utils.TestRunner.takeScreenShot(TestRunner.java:112)
    at com.bb.tools.mobileautomation.utils.TestRunner.tearDown(TestRunner.java:99)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

Steps to reproduce (if relevant, you MUST provide a simplified html page or
link to public site):
<enter repro steps here>

-----Other helpful tips:
Attach your chromedriver log with verbose logging enabled (see
http://goo.gl/5Sx8mC for how to do this).

Original issue reported on code.google.com by pkott...@gmail.com on 22 Dec 2014 at 3:56

GoogleCodeExporter commented 9 years ago
Can you provide me  your test case - a small program that can reproduce the 
issue?

Original comment by andrewch...@chromium.org on 27 Dec 2014 at 12:29

GoogleCodeExporter commented 9 years ago
The issue is reproducible with the apk, that you can find it in this link: 
https://www.dropbox.com/s/iq4xrngeyrlk2ed/Test.apk?dl=0

I automate with appium.

My test case is very simple:
- Load the app, switch to the webview and look for the header with title 
"Login". The step is successful. Though the element exists, it's not displayed.
- Try to click on the "Register" link. The element exists, but it's impossible 
to click it because it's not displayed.

Original comment by pkott...@gmail.com on 5 Jan 2015 at 2:28

GoogleCodeExporter commented 9 years ago
we are not allow to download any apk or exe code here.
do you have Selenium codes that  I can run to reproduce the case?

Original comment by andrewch...@chromium.org on 22 Jan 2015 at 2:11

GoogleCodeExporter commented 9 years ago
What I'm doing in my code is very simple

webDriver.context(contextName);
Where webDriver is AppiumDriver and contextName the webView I want to access.

 WebElement webElement = webDriver.findElement(By.xpath(xpath));
 webElement.click();
xpath is the locator of the element I want to click.

findElement fails. Nevertheless, I can see and verify this locator in chrome 
with Inspect Devices.

I sent you the .apk because we work with Titanium, this is the tool to build 
our application. I don't know if the issue occurs also for other hybrid 
applications developed with different tools. 

Original comment by pkott...@gmail.com on 22 Jan 2015 at 10:03

GoogleCodeExporter commented 9 years ago
your xpath may not correct.
you need provide the code for us to trouble shoot.
Just wrote a test case in Appium, and it ran just fine.

            driver.navigate().to("http://selftechy.com/");      
            //
            WebElement webElement = driver.findElement(By.xpath("//div[@id = 'page']/ul/li[3]/a")); // Click  work
            if (webElement != null)
                webElement.click();

> info: --> POST /wd/hub/session/555cc9e3368e6299641436ffb9755de2/url 
{"url":"http://selftechy.com/"}
> info: [debug] Proxying command to 127.0.0.1:9515
> info: [debug] Making http request with opts: 
{"url":"http://127.0.0.1:9515/wd/hub/session/555cc9e3368e6299641436ffb9755de2/ur
l","method":"POST","json":{"url":"http://selftechy.com/"}}
> info: [debug] Proxied response received with status 200: 
{"sessionId":"555cc9e3368e6299641436ffb9755de2","status":0,"value":null}
> info: <-- POST /wd/hub/session/555cc9e3368e6299641436ffb9755de2/url 200 
4881.371 ms - 72 
> info: --> POST /wd/hub/session/555cc9e3368e6299641436ffb9755de2/element 
{"using":"xpath","value":"//div[@id = 'page']/ul/li[3]/a"}
> info: [debug] Proxying command to 127.0.0.1:9515
> info: [debug] Making http request with opts: 
{"url":"http://127.0.0.1:9515/wd/hub/session/555cc9e3368e6299641436ffb9755de2/el
ement","method":"POST","json":{"using":"xpath","value":"//div[@id = 
'page']/ul/li[3]/a"}}
> info: [debug] Proxied response received with status 200: 
{"sessionId":"555cc9e3368e6299641436ffb9755de2","status":0,"value":{"ELEMENT":"0
.3876677581574768-1"}}
> info: <-- POST /wd/hub/session/555cc9e3368e6299641436ffb9755de2/element 200 
448.960 ms - 102 
> info: --> POST 
/wd/hub/session/555cc9e3368e6299641436ffb9755de2/element/0.3876677581574768-1/cl
ick {"id":"0.3876677581574768-1"}
> info: [debug] Proxying command to 127.0.0.1:9515
> info: [debug] Making http request with opts: 
{"url":"http://127.0.0.1:9515/wd/hub/session/555cc9e3368e6299641436ffb9755de2/el
ement/0.3876677581574768-1/click","method":"POST","json":{"id":"0.38766775815747
68-1"}}
> info: [debug] Proxied response received with status 200: 
{"sessionId":"555cc9e3368e6299641436ffb9755de2","status":0,"value":null}

Original comment by andrewch...@chromium.org on 22 Jan 2015 at 8:41

GoogleCodeExporter commented 9 years ago

Original comment by andrewch...@chromium.org on 6 Feb 2015 at 1:54

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 21 Feb 2015 at 12:26