I have a scenario which I need to switch Apps by using Selenium and Appium. I'm starting with the browser, then I need to have some information from notification bar and then switch back to the browser. I managed to do each process as a stand-alone. but now I'm struggling doing it as End to End process.
I have started by creating a webdriver session, but I can't open a new session while he first one is still running. the problem is that the browser and appium have different sessions. One is being called by
_driver = new AndroidDriver<AppiumWebElement>(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities, TimeSpan.FromSeconds(180));
And the second one by
_webdriver = new RemoteWebDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities, TimeSpan.FromSeconds(180));
I managed to do what needed. All I needed to do is to run AndroidDriver first with Chrome appActivity and appPackage.
Then, use driver.Context = NATIVE_APP;
in order to use the Android's activities.
going back to chrome is pretty easy as well. driver.context = "WEBPAGE_1";
this syntax belongs to C#.
in order to know which context you are currently using, use this code:
var Handledcontext=driver.Context.Tostring();
good luck and thank you all for trying helping me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With