MObile web automation

please let meknow if any tools for mobile automation for web apps.in appium i could not find that feature

thanks
mahender

Mobile automation of web application is supported by Appium

can u tell me the procedure to configure appium for mobile web automation

ya sure can you briefly explain what is that you are trying to achieve, also share the information w.r.t configuration(appium version, mobile OS, Browser, etc…)

@Mahender_Tirumala:- Appium Supports

  1. Native Apps
  2. Web Apps
  3. Hybrid Apps
    Your can check my videos for appium configuration and then run the attached script to test webapps.
    https://www.youtube.com/watch?v=WgnusVu9IcgWebapp_help.txt (1.9 KB)
1 Like

Thank you Appium master.,iam getting below error when i run your code, can you please help

FAILED CONFIGURATION: @BeforeMethod setup
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Did not get session redirect from Chromedriver

FAILED: launchwebsite
java.lang.NullPointerException
at mobweb.launchwebsite(mobweb.java:51)

@Mahender_Tirumala:-

  1. Are you using Appium 1.3.4.1? If not please upgrade to latest one
  2. Please upgrade latest java client libs
    and try one more time
    or else paste full log to understand what went wrong

I just tried the same code in my step and it is working properly.

i am using on Appium 1.3.4.1 and java client 2.1.0…below is the full error code

AILED: launchwebsite
java.lang.NullPointerException
at mobweb.launchwebsite(mobweb.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0

===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0

[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 11 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@626b2d4a: 21 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@cac736f: 15 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@726f3b58: 105 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@aec6354: 56 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@1ee0005: 5 ms

Appium errors

error: Chromedriver create session did not work. Status was 200 and body was {“sessionId”:“7476d1050aa4964df2220c71667ef285”,“status”:13,“value”:{“message”:“unknown error: Device emulator-5554 is already in use\n (Driver info: chromedriver=2.10.267521,platform=Windows NT 6.1 SP1 x86_64)”}}

info: [debug] Error: Did not get session redirect from Chromedriver
at null. (D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\lib\devices\android\chromedriver.js:222:12)
at Request._callback (D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\lib\devices\common.js:121:5)
at Request.self.callback (D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\node_modules\request\request.js:121:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request. (D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\node_modules\request\request.js:985:14)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage. (D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\node_modules\request\request.js:936:12)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at process._tickDomainCallback (node.js:459:13)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Did not get session redirect from Chromedriver)”,“origValue”:“Did not get session redirect from Chromedriver”},“sessionId”:null}
error: Unexpected error: Error: Can’t set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (http.js:691:11)
at ServerResponse.res.set.res.header (D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\node_modules\express\lib\response.js:561:10)
at ServerResponse.res.json (D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\node_modules\express\lib\response.js:208:36)
at ServerResponse.res.send (D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\node_modules\express\lib\response.js:121:21)
at D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\lib\server\responses.js:69:9
at safely (D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\lib\server\helpers.js:306:5)
at exports.respondError (D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\lib\server\responses.js:68:3)
at D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\lib\server\controller.js:187:9
at Appium.cleanupSession (D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\lib\appium.js:325:21)
at null. (D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\lib\appium.js:267:28) context: [POST /wd/hub/session {“desiredCapabilities”:{“browserName”:“Browser”,“platformName”:“Android”,“device”:“Android”,“deviceName”:“Emulator-5554”,“platformVersion”:“4.4.2”}}]
info: [debug] 1 device(s) connected
info: [debug] executing cmd: C:\Users\mtirumala\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 shell “am force-stop com.android.browser”
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] Cleaning up appium session
info: → POST /wd/hub/session {“desiredCapabilities”:{“appPackage”:“com.android.chrome”,“appActivity”:“com.google.android.apps.chrome.document.ChromeLauncherActivity”,“platformVersion”:“4.4.2”,“browserName”:“chrome”,“platformName”:“Android”,“device”:“Android”,“deviceName”:“Emulator-5554”}}
info: Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : device
info: Set mode: Proxying straight through to Chromedriver
info: [debug] Looks like we want chrome on android
info: [debug] Creating new appium session 110cdcd8-47f8-4d1b-b4e2-6bb3c55013f6
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming it’s already on the device
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Users\mtirumala\AppData\Local\Android\android-sdk\platform-tools\adb.exe
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: C:\Users\mtirumala\AppData\Local\Android\android-sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device emulator-5554
info: [debug] Setting device id to emulator-5554
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\Users\mtirumala\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 wait-for-device
info: [debug] executing cmd: C:\Users\mtirumala\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Pushing unlock helper app to device…
info: [debug] executing cmd: C:\Users\mtirumala\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 install “D:\mobile\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk”

also do i need to install apk file in emulator??

do i need to change?

com.google.android.apps.chrome.document.ChromeLauncherActivity"

also do i need to install chrome in emulator?

@Appium_Master just checking Appium 1.3.4.1 does not exist as an install target
npm ERR! notarget [“0.0.1”,“0.0.2”,“0.0.3”,“0.0.4”,“0.0.5”,“0.0.6”,“0.0.7”,“0.0.8”,“0.0.9”,“0.0.10”,“0.0.11”,“0.0.12”,“0.0.13”,“0.0.14”,“0.0.15”,“0.1.0”,“0.1.1”,“0.1.2”,“0.2.0”,“0.2.1”,“0.2.2”,“0.2.3”,“0.3.0”,“0.3.1”,“0.4.0”,“0.4.1”,“0.5.0”,“0.5.1”,“0.5.2”,“0.6.0”,“0.6.1”,“0.7.0”,“0.7.1”,“0.7.2”,“0.7.3”,“0.8.0”,“0.8.1”,“0.8.2”,“0.8.3”,“0.8.4”,“0.8.5”,“0.9.0”,“0.9.1”,“0.10.0”,“0.10.1”,“0.10.2”,“0.10.3”,“0.10.4”,“0.11.0”,“0.11.1”,“0.11.2”,“0.11.3”,“0.11.4”,“0.12.0”,“0.12.1-b”,“0.12.2”,“0.12.3”,“0.13.0”,“0.14.0”,“0.14.1”,“0.14.2”,“0.15.0”,“0.16.0”,“0.17.0”,“0.17.2”,“0.17.3”,“0.17.4”,“0.17.5”,“0.17.6”,“0.18.0”,“0.18.1”,“1.0.0-beta.1”,“0.18.2”,“1.0.0-beta.2”,“1.0.0”,“1.1.0”,“1.2.0”,“1.2.1”,“1.2.2”,“1.2.3”,“1.3.0-beta1”,“1.2.4”,“1.3.0”,“1.3.1”,“1.3.2-beta2”,“1.3.3”,“1.3.4-beta1”,“1.3.4”]

@Mahender_Tirumala:

  1. Yes you need to install chrome browser to your emulator
  2. Download Chrome.apk
  3. use adb install chrome.apk command to install apk file to emulator
  4. Once done then re-Run your same test, again it will work

Hi master, i downloaded http://www.apkmirror.com/apk/google-inc/chrome/chrome-38-0-2125-114-apk/
and installed, but when i launch manually in emulator, chrome is opening and closing…
can u tell me exact version of apk,file you have downleaded

when i launch chrome from emulator, its throwing error as “unfortunately chrome has stopped”

@Mahender_Tirumala:

  1. You can download the build from
    http://www.apk4fun.com/files/1192/
  2. Restart your emulator and select wipe data

You can watch my video

still iam getting same error as attached above…i watched your video, is this syntax correct
capabilites.setCapability(“deviceName”, “10.0.0.3:5555”);

as the device name is emulator:5554 right?