开发者

Running Selenium Tests on Android

开发者 https://www.devze.com 2023-04-03 07:56 出处:网络
I\'ve been trying to get Selenium server to run an existing suite of tests (made in Selenium IDE) to run in several target platforms. I\'m using a batch file as we want to run the tests on nightly/wee

I've been trying to get Selenium server to run an existing suite of tests (made in Selenium IDE) to run in several target platforms. I'm using a batch file as we want to run the tests on nightly/weekly jobs. I have the following:

@echo off
cls

echo Launching Selenium under Internet Explorer
java -jar "c:\selenium\selenium-server-standalone-2.5.0.jar" -trustAllSSLCertificates -multiwindow -htmlSuite "*iehta" "http://mywebsite.com" "c:\selenium\tests\mytest.html" "c:\selenium\results\ie.html"
echo completed....
echo ---------------------------------------------------------------------------------

echo Launching Selenium under Firefox
java -jar "c:\selenium\selenium-server-standalone-2.5.0.jar" -trustAllSSLCertificates -multiwindow -htmlSuite "*firefox" "http://mywebsite.com" "c:\selenium\tests\mytest.html" "c:\selenium\results\firefox.html"
echo completed....
echo ---------------------------------------------------------------------------------

echo Launching Selenium under Google Chrome
java -jar "c:\selenium\selenium-server-standalone-2.5.0.jar" -trustAllSSLCertificates -multiwindow -htmlSuite "*googlechrome" "http://mywebsite.com" "c:\selenium\tests\mytest.html" "c:\selenium\results\chrome.html"
echo completed....

echo ---------------------------------------------------------------------------------
echo Launching Selenium under Opera
java -jar "c:\selenium\selenium-server-standalone-2.5.0.jar" -trustAllSSLCertificate开发者_Python百科s -multiwindow -htmlSuite "*opera" "http://mywebsite.com" "c:\selenium\tests\mytest.html" "c:\selenium\results\opera.html"
echo completed....

echo ---------------------------------------------------------------------------------
echo Launching Selenium under Android
emulator -avd testdroid -no-boot-anim -scale .6
echo Waiting for device to connect...
adb wait-for-device
adb devices
echo Forwarding tcp port...
adb -s emulator-5554 forward tcp:8080 tcp:8080
echo Unlocking device...
adb shell input keyevent 82
echo Running Selenium...
java -jar c:\selenium\selenium-server-standalone-2.5.0.jar -proxyInjectionMode -trustAllSSLCertificates -htmlSuite "*custom adb -s emulator-5554 shell am start -a android.intent.action.VIEW -d http://localhost:4444/wd/hub/ -n org.openqa.selenium.android.app/org.openqa.selenium.android.app.MainActivity" "http://mywebsite.com" "c:\selenium\tests\mytest.html" "c:\selenium\results\android.html"
rem echo completed....
rem adb kill-server

As far is it goes that seems to work but: IE is locking up early on in the tests, will eventually give script/memory warning but the whole app becomes unresponsive.

Android SDK does indeed launch my test AVD, does unlock and launches webdriver. But that's all it's doing.

So my main concern is how to get Android webdriver to start running the tests. If anyone has ideas on the IE thing that would be nice but Android is really the issue.


Your best bet will to export the test as a plain WebDriver test (not using the WebDriverBackedSelenium) and run it with the AndroidDriver.

We've never tested using Selenium Core as you are, so I suspect that won't work as expected.


For the desktop tests it turned out to be an issue with changing servers, albeit on the same domain. -disable-web-security didn't help but it was acceptable to client requirements that Firfox run application tests and the browser collection run UI based tests that don't traverse servers.

IE9 still runs out of memory, even if doubling the memory through windows registry, but I may be able to refine some of the tests to deal with that.

Android remains obstinate.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号