From when Appium is going to support identification and automation of toast messages?


#1

Continuing the discussion from Appium 1.4.16 released:

@jonahss @moizjv
Thanks in Advance :smile:


#2

How can we launch safari in real devices say I have iPod 5 (OS version 8.0.2). I have written the code like below:

package com.mob.safari;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;

public class SafariLaunch {
AppiumDriver driver;

@Test
public void Launch() {
	// driver.get("http://google.com");
}

@BeforeTest
public void beforeTest() throws MalformedURLException {
	DesiredCapabilities capabilities = new DesiredCapabilities();
	capabilities.setCapability("platformName", "iOS");
	capabilities.setCapability("deviceName", "iPod 5");
	capabilities.setCapability(CapabilityType.VERSION, "8.0.2");
	capabilities.setCapability("udid", "af5020497b55d10f41a88c488051a85927765a08");
	capabilities.setCapability(CapabilityType.BROWSER_NAME, "safari");
	URL url = new URL("http", "0.0.0.0", 4723, "/wd/hub");
	driver = new AppiumDriver<WebElement>(url, capabilities) {

		@Override
		public MobileElement scrollToExact(String arg0) {
			// TODO Auto-generated method stub
			return null;
		}

		@Override
		public MobileElement scrollTo(String arg0) {
			// TODO Auto-generated method stub
			return null;
		}
	};
	driver.get("https://www.google.com/");

}

@AfterTest
public void afterTest() {

}

}

Following are the errors I am getting when run the code.

org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: ENOENT: no such file or directory, stat ‘/usr/local/lib/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 674 milliseconds
Build info: version: ‘2.47.1’, revision: ‘411b314’, time: ‘2015-07-30 03:03:16’
System info: host: ‘Sanojs-Mac-mini.local’, ip: ‘172.16.2.243’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.11’, java.version: ‘1.8.0_60’
Driver info: com.mob.safari.SafariLaunch$1

My system spec:

MAC OS: 10.11
Xcode: 7.0

Please help me to run the safari in real devices. Because next we are starting the mobile web automation using appium.


#3

@sanoj27 Can you post your Appium Log here??


#4

Here is the logs:

Last login: Fri Nov 27 00:43:00 on ttys001
Sanojs-Mac-mini:~ sanoj$ appium
info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: Console LogLevel: debug
info: --> POST /wd/hub/session {“desiredCapabilities”:{“appium-version”:“1.3.1”,“browserName”:“safari”,“udid”:“af5020497b55d10f41a88c488051a85927765a08”,“platformName”:“iOS”,“deviceName”:“iPod 5”,“version”:“8.0.2”}}
info: Client User-Agent string: Apache-HttpClient/4.4.1 (Java/1.8.0_60)
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. : appium-version, version
info: [debug] Configuring Safari session
info: [debug] Using local .zip from command line: /usr/local/lib/node_modules/appium/build/SafariLauncher/SafariLauncher.zip
info: [debug] Copying local zip to tmp dir
info: [debug] Got configuration error, not starting session
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: ENOENT: no such file or directory, stat ‘/usr/local/lib/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’
info: [debug] Error: ENOENT: no such file or directory, stat ‘/usr/local/lib/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’
at Error (native)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: ENOENT: no such file or directory, stat ‘/usr/local/lib/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’)”,“errno”:-2,“code”:“ENOENT”,“syscall”:“stat”,“path”:"/usr/local/lib/node_modules/appium/build/SafariLauncher/SafariLauncher.zip",“origValue”:“ENOENT: no such file or directory, stat ‘/usr/local/lib/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 13.459 ms - 482


#5

@sanoj27 have a look into the following link : Solution to launch Safari Browser in Real Device

Hope, it resolves your problem :wink:


#6

Hi @jonahss, Can you please provide some information regarding “From when Appium is going to support identification and automation of toast messages?”
This information is very essential for me for my current project. :blush:


#7

I assume you’re talking about Android.

I don’t think the Android project has given us any way to automate Toasts. You’ll have to ask them to provide us a way to interact with them through UiAutomator2.

Or can you find a hack? I didn’t see anything quickly looking on Stack Overflow.


#8

Hi @jonahss,
Really appreciate that you took time to reply to my query, Thanks!

I understand your point, So can you please suggest me any proper alternative(hack) to handle toast message verification. I have tried a lot to find alternatives over Google but didn’t get any proper solution, So if you are aware of any solution, Please help me out.


#9

Ooh, try taking a screenshot when the toast is expected to appear.

You can use image-recognition software, or a visual test regression product like Applitools to run assertions based on the image.


#10

Check this


#11

#12

Using latest version of appium-uiautomator2-driver should support toast message verification

refer sample java test