{"action":"opened","issue":{"url":"https://api.github.com/repos/appium/appium/issues/6266","repository_url":"https://api.github.com/repos/appium/appium","labels_url":"https://api.github.com/repos/appium/appium/issues/6266/labels{/name}","comments_url":"https://api.github.com/repos/appium/appium/issues/6266/comments","events_url":"https://api.github.com/repos/appium/appium/issues/6266/events","html_url":"https://github.com/appium/appium/issues/6266","id":139821885,"number":6266,"title":"webview setWebViewClient didn‘t have an effect when test by appium selendroid","user":{"login":"easyforgood","id":3717140,"avatar_url":"https://avatars.githubusercontent.com/u/3717140?v=3","gravatar_id":"","url":"https://api.github.com/users/easyforgood","html_url":"https://github.com/easyforgood","followers_url":"https://api.github.com/users/easyforgood/followers","following_url":"https://api.github.com/users/easyforgood/following{/other_user}","gists_url":"https://api.github.com/users/easyforgood/gists{/gist_id}","starred_url":"https://api.github.com/users/easyforgood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/easyforgood/subscriptions","organizations_url":"https://api.github.com/users/easyforgood/orgs","repos_url":"https://api.github.com/users/easyforgood/repos","events_url":"https://api.github.com/users/easyforgood/events{/privacy}","received_events_url":"https://api.github.com/users/easyforgood/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-10T08:36:42Z","updated_at":"2016-03-10T08:36:42Z","closed_at":null,"body":"## The problem\r\n\r\nwebview.setWebViewClient() didn't work when I want to override a shouldOverrideUrlLoading().\r\n\r\nsome operator in shouldOverrideUrlLoading() but it didn't work when using appium and selendroid\r\n\r\n## Environment\r\n\r\n* Appium version (or git revision) that exhibits the issue: 1.4.16.1\r\n* Last Appium version that did not exhibit the issue (if applicable):\r\n* Desktop OS/version used to run Appium: Windows7 32bit\r\n* Node.js version (unless using Appium.app|exe): v4.2.2\r\n* Mobile platform/version under test: android 4.3 \r\n* Real device or emulator/simulator: emulator\r\n* Appium CLI or Appium.app|exe: Appium.exe\r\n\r\n## Details\r\n\r\nI test  run with the Appium auto-operator and without appium by manual.\r\n\r\nSetting some log.i in the  @Override  shouldOverrideUrlLoading().\r\n\r\nOn the manual hand, every log print could be found.\r\nBut On the other appium test hand, It hasn’t been find and just like shouldOverrideUrlLoading() didn't exsit.\r\n\r\n\r\n\r\n \r\n## Link to Appium logs\r\n\r\n [gist](https://gist.github.com/easyforgood/700e33ac69828d42c0e2)  \r\n\r\n> info: [debug] Making http request with opts: {\"url\":\"http://localhost:8080/wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/window_handles\",\"method\":\"GET\"}\r\n> info: [debug] Available contexts: [\"NATIVE_APP\",\"WEBVIEW_0\"]\r\n> info: [debug] Responding to client with success: {\"status\":0,\"value\":[\"NATIVE_APP\",\"WEBVIEW_0\"],\"sessionId\":\"860b4876-c367-f05c-d73a-6e97d8c17b86\"}\r\n> info: <-- GET /wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/contexts 200 281.003 ms - 98 {\"status\":0,\"value\":[\"NATIVE_APP\",\"WEBVIEW_0\"],\"sessionId\":\"860b4876-c367-f05c-d73a-6e97d8c17b86\"}\r\n> info: --> POST /wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/context {\"name\":\"WEBVIEW_0\"}\r\n> info: [debug] Getting a list of available webviews\r\n> info: [debug] executing cmd: D:\\android-sdk\\platform-tools\\adb.exe -s emulator-5554 shell \"cat /proc/net/unix\"\r\n> info: [debug] Available contexts: NATIVE_APP,WEBVIEW_0\r\n> info: [debug] []\r\n> info: [debug] Making http request with opts: {\"url\":\"http://localhost:8080/wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/window_handles\",\"method\":\"GET\"}\r\n\r\n\r\n> info: [debug] Available contexts: [\"NATIVE_APP\",\"WEBVIEW_0\"]\r\n> info: [debug] Making http request with opts: {\"url\":\"http://localhost:8080/wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/context\",\"method\":\"POST\",\"json\":{\"name\":\"WEBVIEW_0\"}}\r\n> info: [debug] [SELENDROID] Unable to resolve superclass of Lio/selendroid/server/model/SelendroidWebDriver$ExtendedSystemWebChromeClient; (1841)\r\n> info: [debug] [SELENDROID] Link of class 'Lio/selendroid/server/model/SelendroidWebDriver$ExtendedSystemWebChromeClient;' failed\r\n> info: [debug] [SELENDROID] Could not find class 'io.selendroid.server.model.SelendroidWebDriver$ExtendedSystemWebChromeClient', referenced from method io.selendroid.server.model.SelendroidWebDriver.encapulateWebChromeClientForView\r\n> info: [debug] [SELENDROID] unable to resolve new-instance 1456 (Lio/selendroid/server/model/SelendroidWebDriver$ExtendedSystemWebChromeClient;) in Lio/selendroid/server/model/SelendroidWebDriver;\r\n> info: [debug] [SELENDROID] Unable to resolve superclass of Lio/selendroid/server/model/SelendroidWebDriver$SelendroidSystemWebViewClient; (1843)\r\n> info: [debug] [SELENDROID] Link of class 'Lio/selendroid/server/model/SelendroidWebDriver$SelendroidSystemWebViewClient;' failed\r\n> info: [debug] [SELENDROID] Could not find class 'io.selendroid.server.model.SelendroidWebDriver$SelendroidSystemWebViewClient', referenced from method io.selendroid.server.model.SelendroidWebDriver.encapulateWebViewClientForView\r\n> info: [debug] [SELENDROID] unable to resolve new-instance 1458 (Lio/selendroid/server/model/SelendroidWebDriver$SelendroidSystemWebViewClient;) in Lio/selendroid/server/model/SelendroidWebDriver;\r\n> info: [debug] [SELENDROID] Unable to resolve superclass of Lio/selendroid/server/model/SelendroidWebDriver$ExtendedSystemWebChromeClient; (1841)\r\n> info: [debug] [SELENDROID] Link of class 'Lio/selendroid/server/model/SelendroidWebDriver$ExtendedSystemWebChromeClient;' failed\r\n> info: [debug] [SELENDROID] Unable to resolve superclass of Lio/selendroid/server/model/SelendroidWebDriver$SelendroidSystemWebViewClient; (1843)\r\n> info: [debug] [SELENDROID] Link of class 'Lio/selendroid/server/model/SelendroidWebDriver$SelendroidSystemWebViewClient;' failed\r\n> info: [debug] Responding to client with success: {\"status\":0,\"value\":null,\"sessionId\":\"860b4876-c367-f05c-d73a-6e97d8c17b86\"}\r\n> info: <-- POST /wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/context 200 904.860 ms - 76 {\"status\":0,\"value\":null,\"sessionId\":\"860b4876-c367-f05c-d73a-6e97d8c17b86\"}\r\n> info: --> POST /wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/context {\"name\":\"WEBVIEW_0\"}\r\n> info: [debug] Getting a list of available webviews\r\n> info: [debug] executing cmd: D:\\android-sdk\\platform-tools\\adb.exe -s emulator-5554 shell \"cat /proc/net/unix\"\r\n> info: [debug] Available contexts: NATIVE_APP,WEBVIEW_0\r\n> info: [debug] []\r\n> info: [debug] Making http request with opts: {\"url\":\"http://localhost:8080/wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/window_handles\",\"method\":\"GET\"}\r\n> info: [debug] Available contexts: [\"NATIVE_APP\",\"WEBVIEW_0\"]\r\n> info: [debug] Responding to client with success: {\"status\":0,\"value\":null,\"sessionId\":\"860b4876-c367-f05c-d73a-6e97d8c17b86\"}\r\n> info: <-- POST /wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/context 200 269.353 ms - 76 {\"status\":0,\"value\":null,\"sessionId\":\"860b4876-c367-f05c-d73a-6e97d8c17b86\"}\r\n> info: --> POST /wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/element {\"using\":\"link text\",\"value\":\"click app me\"}\r\n> info: [debug] Proxying command to localhost:8080\r\n> info: [debug] Making http request with opts: {\"url\":\"http://localhost:8080/wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/element\",\"method\":\"POST\",\"json\":{\"using\":\"link text\",\"value\":\"click app me\"}}\r\n> info: [debug] Proxied response received with status 200: {\"value\":{\"ELEMENT\":\":wdc:1457598532243\"},\"status\":0,\"sessionId\":\"860b4876-c367-f05c-d73a-6e97d8c17b86\"}\r\n> info: <-- POST /wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/element 200 1251.147 ms - 104 \r\n> info: --> POST /wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/element/%3Awdc%3A1457598532243/click {\"id\":\":wdc:1457598532243\"}\r\n> info: [debug] Proxying command to localhost:8080\r\n> info: [debug] Making http request with opts: {\"url\":\"http://localhost:8080/wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/element/%3Awdc%3A1457598532243/click\",\"method\":\"POST\",\"json\":{\"id\":\":wdc:1457598532243\"}}\r\n> info: [debug] Proxied response received with status 200: {\"value\":\"\",\"status\":0,\"sessionId\":\"860b4876-c367-f05c-d73a-6e97d8c17b86\"}\r\n> info: <-- POST /wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/element/%3Awdc%3A1457598532243/click 200 1598.258 ms - 74 \r\n> info: --> POST /wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/timeouts {\"type\":\"script\",\"ms\":20000}\r\n> info: [debug] Proxying command to localhost:8080\r\n> info: [debug] Making http request with opts: {\"url\":\"http://localhost:8080/wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/timeouts\",\"method\":\"POST\",\"json\":{\"type\":\"script\",\"ms\":20000}}\r\n> info: [debug] Proxied response received with status 200: {\"status\":0,\"sessionId\":\"860b4876-c367-f05c-d73a-6e97d8c17b86\"}\r\n> info: <-- POST /wd/hub/session/860b4876-c367-f05c-d73a-6e97d8c17b86/timeouts 200 101.053 ms - 63 \r\n\r\n## Code To Reproduce Issue [ Good To Have ]\r\n\r\nappium.java\r\n```\r\nDesiredCapabilities capabilities = new DesiredCapabilities();\r\n\t\tcapabilities.setCapability(\"deviceName\", \"emulator-5554\");\r\n\t\tcapabilities.setCapability(\"platformVersion\", \"4.3.1\");\r\n\t\tcapabilities.setCapability(\"platformName\", \"Android\");\r\n\t\tcapabilities.setCapability(MobileCapabilityType.APP,\r\n\t\t\t\t\"D:\\\\JAVAWORKSPACE\\\\TestforAppium\\\\bin\\\\TestforAppium.apk\");\r\n\t\tcapabilities.setCapability(\"automationName\", \"Selendroid\");\r\n\t\tcapabilities.setCapability(\"appPackage\", \"com.example.testforappium\");\r\n\t\tcapabilities.setCapability(\"appActivity\", \".MainActivity\");\r\n\t\tAndroidDriver driver = null;\r\n\t\ttry {\r\n\t\t\tURL url = new URL(\"http://127.0.0.1:4723/wd/hub\");\r\n\t\t\tdriver = new AndroidDriver(url, capabilities);\r\n\t\t\tdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);\r\n\t\t\tdriver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);\r\n\t\t\tSet<String> contextNames =  ((AppiumDriver) driver).getContextHandles();\r\n\t\t\tdriver.context(\"WEBVIEW_0\");\r\n\t\t\tdriver.findElementByLinkText(\"click app me\").click();\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n```\r\n\r\n--------\r\n\r\n\r\nMainActivity.java\r\n\r\n```\r\n\tsetContentView(R.layout.activity_main);\r\n\t\twebview= (WebView) this.findViewById(R.id.webView1);\r\n\t\tLog.i(\"finish\", \"1\");\r\n\t\twebview.setWebViewClient(new WebViewClient(){\r\n\t\t\t@Override\r\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url){\r\n\t\t\t\tLog.i(\"finish\", \"2\");\r\n\t\t\t\tif(url.startsWith(\"http://baidu\")){\r\n\t\t\t\t\tLog.i(\"finish\", \"3\");\r\n\t\t\t\t\ttestOperation();\r\n\t\t\t\t}\r\n\t\t\t\tview.loadUrl(url);\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t});\r\n\t\twebview.loadUrl(\"http://172.27.146.62/\");\r\n\t\t\r\n\t}\r\n```\r\n\r\n"}}