-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test Script not able to locate element on Real Device post switching to webview of a hybrid app. #243
Comments
Those don't look like Appium logs |
Your client code also appears to be using some kind of framework so it's not really possible to understand what commands are being run without seeing the Appium logs |
Hi Jlipps, Link to Appium logs
Links to chromedriver Logs Chromedriver getpagesource() response logs on real device. <script src="https://gist.github.com/Rahul1970/bf078ac294e534b7749f5e33493bd110.js"></script>Please Suggest. |
It seems like the chromedriver/chrome browser version itself could not find it.
One possible reason from this comment is newer chrome/chromedriver cannot find them. If you have a device that has older chrome, you can try it out... |
Hi KazuCocoa, |
Yes, so I assume older chrome version and chromedriver for Android might work. |
You also can create a Play Store available emulator instance and update the chrome to v98 to confirm if it is chrome/chromedriver dependent or manufacture dependent. |
Hi KazuCocoa, (Steps used for downgrading chromebrowser version 1. Disable autoupdate 2. Uninstall updates for chromedriver 3. Install the downgrade version browser apk. 4 Install the chromedriver version matching the browser apk .) |
Perhaps the android WebView's chrome browser version was v99.
Generally it means the app's webview process runs as chrome browser v99, and the chromedriver cannot work with it because of lower chromedriver version than the chrome version.
Hm, it sounds like chrome/chromedriver has kind of regressions. Then, only Google can improve it... |
The problem
Unable to locate element on Real Device post switching to webview of a hybrid app.
Environment
Appium version : 1.22.2
Desktop OS/version used to run Appium: Windows 10 Android Version 10
Node.js version : v16.13.1
Npm or Yarn package manager: 8.1.2
Mobile platform/version under test: Android 10
Real device : Galaxy M20
Appium CLI or Appium.app|exe: Appium CLI
Chromedriver on Real Device used: 98.0.4758.48
Chromedriver on Emulator used: 83.0.4103.106
Links to chromedriver Logs
Chromedriver getpagesource() response logs on emulator. https://gist.github.com/Rahul1970/97f8e8fd0a5f1145873a237855ba33c1.js
Chromedriver getpagesource() response logs on real device.
https://gist.github.com/Rahul1970/bf078ac294e534b7749f5e33493bd110.js
Link to Appium logs
1..Appium logs for working code on emulator on successful switch context to webview and able to locate element.
https://gist.github.com/Rahul1970/c503aa9943cf60649a7fed269f5b5797.js
2. Appium logs on real device on successful switch context to webview but not able to locate element.
https://gist.github.com/Rahul1970/585e3c08718ec291bf2b0c4452af89b3.js
Details
In my hybrid mobile application on real device i am able to pass through the native views but when landing on webview and able to switch to webview i am not able to locate element. I am able to locate elements on webview in emulator but not able to do so on real device.
Code To Reproduce Issue [ Good To Have ]
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName);//deviceName
dc.setCapability(MobileCapabilityType.UDID, deviceName );
//dc.setCapability(MobileCapabilityType.PLATFORM_VERSION,platformVersion);
dc.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
dc.setCapability(MobileCapabilityType.APP, System.getProperty("user.dir")+"/src/test/resources/apps/"+AppName);
dc.setCapability("automationName","UiAutomator2");
dc.setCapability("unicodeKeyboard", true);
dc.setCapability("resetKeyboard", true);
dc.setCapability("autoWebview", false);
//dc.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome");
//dc.setCapability("appWaitForLaunch", false);
dc.setCapability("appPackage", "com.crmnextmobile.crmnextofflineplay");
dc.setCapability("appActivity", "com.crmnextmobile.crmnextofflineplay.qr.QrScannerActivity");
driver = new AndroidDriver(service.getUrl(),dc);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
ReUsableMethods.mobileStartRecording();
login();
ReUsableMethods.clickElement(sp.itemMenu," Menu Summary Page ");
ReUsableMethods.clickElement(lp.leadMenu,"Lead Menu Page");
ReUsableMethods.clickElement(lp.addLead,"Lead Add icon");
ReUsableMethods.clickElement(lp.addNewLead,"Add new lead");
Set contextNames = ((SupportsContextSwitching)driver).getContextHandles();
for (String contextName : contextNames)
{
System.out.println("Available Context"+contextName);
}
System.out.println("Before Context Switch"); ////Switching context to webview
((SupportsContextSwitching) driver).context("WEBVIEW_com.crmnextmobile.crmnextofflineplay");
System.out.println("After Context Switch");
Thread.sleep(10000);
ReUsableMethods.mobileStartRecording();
ReUsableMethods.enterText(lp.shortName,Leads[0], "shortname is entered.");
System.out.println(" Context Switched");
Thread.sleep(4000);
Hi Team Any help in this direction would be very helpful.
The text was updated successfully, but these errors were encountered: