I made test which close mobile app and after 2 seconds launch it.
self.welcome_page.confirm_continue()
self.driver.close_app()
sleep(2)
self.driver.launch_app()
sleep(1)
after than I get WebDriverException for every interaction with driver. (e.g. find_element, current_url, refresh ...)
On the screenshot and in the video I see that the app is in expected state and obviously launched successfully.
I am running tests against BrowserStack. with following BrowserCapabilities
[Android]
app=$APP_ID_ANDROID
AppfileName=$APP_NAME_ANDROID
AppCustomID=Corkscrew_andorid
autoAcceptAlerts=true
autoGrantPermissions=true
browserstack.debug=true
device=Samsung Galaxy Note 9
deviceName=Android Emulator
deviceOrientation=portrait
name=cs_test
os=android
os_version=8.1
no-reset=true
full-reset=false
autoWebview=true
response from Webdriver has old version of chromedriver.
'status': 100, 'value': {'message': 'chrome not reachable\n ...o: chromedriver=2.42.591071
appium logs: HERE
probably (I guess) the driver is not active anymore and new one was created by launching app. But how can I get the new driver?
Related
I'm trying to run desktop head unit on my pc. I set up everything exactly as this guide specifies: https://developer.android.com/training/cars/testing, (tried both 2.0 and 1.1 with the same result). It appears to connect correctly, but I can't get it do display anything other than "Waiting for phone". Console displays following:
Android Auto - Desktop Head Unit
Build: 2020-09-20-332761970
Version: 2.0-windows-beta
[W]: No configuration specified - using default values.
[E]: Could not load configuration from 'C:\Users\kkowalczyk\.android\headunit.ini'.
BoringSSL is the SSL implementation used in the receiver-lib.
Starting link. Requested protocol version: 1.6 (snapshot 314970161)
[I]: Connecting over ADB to localhost:5277...
[I]: connected.
> Phone reported protocol version 1.6
ssl state=TLS client read_server_hello -1
ssl state=TLS client process_change_cipher_spec -1
ssl state=SSL negotiation finished successfully 1
SSL version=TLSv1.2 Cipher name=ECDHE-RSA-AES128-GCM-SHA256
Verify returned: ok
I'm trying to connect to Pixel 5 (with most recent update), is there anything else I can try?
In my case, I also saw the same issue but resolve by following below steps:
Close the DHU emulator.
In the AA app, stop the HU server. Wait for a couple of seconds, start the HU server.
Stop the HU server again. Wait for a couple of seconds, start the HU server.
Start the DHU emulator.
The OOBE screen shows up on the AA app in phone. Complete the flow. While you are completing the flow, the emulator will be on the 'waiting for phone' screen.
Stop and start the emulator. It will start with the black screen with 'waiting for phone' message but after 2-3 seconds the emulator screen comes up.
Hope it can resolve your issue too.
I ran into the same issue (stuck on the "Waiting for phone..." screen) and was able to fix it by changing Application Mode to Developer on the Developer Settings screen of Android Auto.
Make sure to restart the head unit server on the phone after that in case it was already running, then reconnect/restart desktop-head-unit.
I ran into similar issues initially and for me the issue was that the "Accept terms" screen of the Android Auto App running on the device that is triggered on connecting to the Emulated HUD was not visible and noticed until I scanned through the recent apps in the Task Switcher.
This is mentioned in step 11 of the Test Android apps for cars - DHU setup instructions here
If this is the first time you are connecting the mobile device to the DHU, check the mobile device's screen to accept the terms of service and adjust permission settings as needed.
So just note that this screen may not be immediately visible to you unless you switch the relevant screen from the Task Switcher.
Try to test your phone on a real car to make sure phone actually works with Android Auto. I have two phones (Huawei p20 and Xiaomi Mi10): xiaomi works fine but p20 doesn't work with multiple settings and/or option neither in car or DHU, however both of them are considered as compatible with Android Auto.
We are attempting to run our tests for our Mobile app on BrowserStack through our Bitbucket pipeline, using Appium version 6.0.0 with the AndroidDriver, which inherits from RemoteWebDriver. We are currently passing the URL to BS with our capabilities (AndroidDriver(AppiumDriverLocalService service, org.openqa.selenium.Capabilities desiredCapabilities)), however the test suite always loses connection to the BrowserStack Hub about half way through.
I wanted to try to add a Factory in the Android Driver to increase the HTTP Timeout and see if that would help my case (AndroidDriver(AppiumDriverLocalService service, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities desiredCapabilities)). The code as is runs fine when running from my local machine to BS but as soon as we run from Bitbucket or even Jenkins, then the network issues start to occur.
Does anyone have an example on how I would be able to achieve this?
Tried this one?
WebDriverWait wait = new WebDriverWait(driver, timeLimitInSeconds);
element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(“desired xpath”)));
Else you can explicitly wait for several seconds using thread.sleep()
I have a situation where I need to run one browser as a client and another browser as an agent. On desktop this is easy and we use the browser of choice for the user and phantom for the agent.
Using Appium and running on the Android emulator I am having problems trying to replicate the desktop setup. I first tried to have the computer run the phantom and then run the Appium tests but I was getting told by Appium that it didn't recognize phantom. I couldn't find a way to have phantom run on the desktop while still using Appium for the phone.
Next I thought I would just automate the agent side directly in Chrome on the phone to avoid the split between desktop and phone. However, I still ran into problems as I can't seem to create new tabs in Chrome to switch to and even with running two different phones I can't switch between them.
We decided to use RobotFramework and AppiumLibrary to code this due to readability for possible end users of this automation.
These are the first keywords run:
*** Keywords ***
Specifying a Known Mobile Device
API Login regression password
sleep 10
Agent Login
Open Application http://localhost:4723/wd/hub platformName=Android browserName=Chrome platformVersion=7.1.1 deviceName=Nexus6P app=com.android.chrome automationName=appium appPackage=com.android.browser appActivity=com.google.android.apps.chrome.Main
go to url blahblah.com
Check Availability Regression Flow HSSMobile
API login and Agent login are:
API Login
[Arguments] ${UN} ${PW}
Set Global Variable ${ACCOUNTNAME} ${UN}
Set Global Variable ${ACCOUNTPWD} ${PW}
Open Application http://localhost:4725/wd/hub platformName=Android browserName=Chrome platformVersion=7.1.1 deviceName=Pixel app=com.android.chrome automationName=appium appPackage=com.android.browser appActivity=com.google.android.apps.chrome.Main
go to url blahblahapi.com
Agent Login
MobileLibrary.Wait Until Element Is Visible ${USERNAME} 25
MobileLibrary.Input Text ${USERNAME} ${ACCOUNTNAME}
MobileLibrary.Input Text ${PASSWORD} ${ACCOUNTPWD}
MobileLibrary.Click Element ${LOGIN}
I imagine I am doing something wrong in the Open Application keyword but I'm not sure. I am running two instances of Appium in the command line.
appium
and
appium -p 4725
Yet, everything runs on only one of the phones.
I am Testing an android app on multiple real devices like the Samsung S6 and S7 and both are connected to the machine at the same time.
Using Appium library within Robot Framework; Open Application keyword always opens the application which comes first in the list of "adb devices".
Key word used :
Open Application ${APPIUM_SERVER_URL} alias=MyMv1 platformName=${PLATFORM_NAME} platformVersion=${PLATFORM_VERSION} deviceName=${DEVICE_NAME} appPackage=${app_package_name} appActivity=${activity} automationName=appium
It seems deviceName is not working, and I can give any value to it.
Library Version Used :
robotframework==3.0.2
robotframework-appiumlibrary==1.4.3
Sometime just after I launched a new emulator, for very first time I was trying to upload my apk, however I got "emulator: ERROR: the user data image is used by another emulator. aborting".
I launched a new emulator, and left it alone, several minutes later, DDMS showed "device offline".
I had to restart a new one, you know, minutes wasted.
It's really bothering that I keep getting this error and slowed down debugging.
How do I fix it?
If the emulator is still alive, you can tell adb to connect to it via tcp (which is I believe what it does anyway, only it normally uses an 'emulator' class of name and would now get a ip:port one)
It's been a while since I've had to do that, but I think that if you were using emulator-5554 you would connect to your development machine's loopback one port higher, ie:
adb connect localhost:5555
If it works adb devices will show it an eclipse should see it as a deployment option
The 'in use' problem sounds like a stale lockfile perhaps left behind in a crash
I have another solution. try this
Run configurations > Target > Wipe user data > Run
In my case it happens when I have another process listening on emulator port.
e.g. if I see:
emulator-5554 offline
it means that something is using port 5554
Manually delete these following folders:
C:\Users\%UserName%.android\avd\AVD2.1.avd\cache.img.lock
C:\Users\%UserName%.android\avd\AVD2.1.avd\userdata-qemu.img.lock
this always works for me. :3
On Arch Linux x64, I had this similar problem which led me to this question. Using Eclipse, the emulator-5554 window would freeze, and Eclipse prompted me to start a new one. In the following dialog, emulator-5554 was reported to be offline, with an unknown target. If I started a new instance, it would be emulator-5556. This problem persisted through Eclipse restarts and log-off-on cycles too! Further, killx would close the window, but the process was still running.
So, find the emulator64-arm process id (not emulator-arm!):
ps ax | grep "emulator64-arm"
...and then just kill -9 it:
sudo kill -9 6728
...where 6728 was its PID. This completely disconnects the emulator so Eclipse can try to run it again.
Open android debug monitor window by
typing "monitor" command in cmd,
then select device in the monitor window,
click on down arrow as shown in the figure then just click on reset tab thats all you will get internet connection.
It was some strange
I had that problem, automatically stopped the emulator localhost:5554 after to launch the application.
I didn't know why it happens but intil today I did something different at I could launch as normality.
What I did as different was to change the prespective of Eclipse ADT. I was executing the application from Debug and now I executed from Java Prespective, it worked, I don't know the reason, I had to share it, sound some .. this answer but I resolved doing that without deleting and creating again my android virtual device.