private static WebDriver driver;
@BeforeTest
public void setUp() throws Exception {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("app", "safari");
caps.setCapability("device", "iPad Device");
caps.setCapability("version", "6.1");
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub/"), caps);
System.out.println("Pausing.. Manually switch to safari now..");
//here i manually switched to safari on the device
Thread.sleep(10000);
for(String winHandle : driver.getWindowHandles()){
driver.switchTo().window(winHandle);
}
driver.get("http://mail.aol.com");
Thread.sleep(5000);
}
First of all when it is instantiating the remotewebdriver, it is
launching the ipad simulator (does it launch even when we want to run on
device only) opens the safari browser and then throws the below errror
in appium console:
info: Welcome to Appium v0.8.5 (REV 3a6720dd1204c04a4fe89a4482eb87366394acca)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: socket.io started
debug: Appium request initiated at /wd/hub/session
info: Trying to use mobile safari, version 6.1
debug: Request received with params: {"desiredCapabilities":{"app":"safari","device":"iPad Device","version":"6.1"}}
info: Looking for built in app MobileSafari
info: Got app, trying to copy to tmp dir
info: Copied MobileSafari to /tmp/Appium-MobileSafari.app
info: Using mobile safari app at /tmp/Appium-MobileSafari.app
info: Cleaning mobile safari data files
info: Determining current user
info: User is pavithrank
info: Deleting /Users/pavithrank/Library/Application\ Support/iPhone\ Simulator/6.1/Library/Caches/Snapshots/com.apple.mobilesafari
info: Deleting /Users/pavithrank/Library/Application\ Support/iPhone\ Simulator/6.1/Library/Caches/com.apple.mobilesafari/Cache.db*
info: Deleting /Users/pavithrank/Library/Application\ Support/iPhone\ Simulator/6.1/Library/Caches/com.apple.WebAppCache/*.db
info: Deleting /Users/pavithrank/Library/Application\ Support/iPhone\ Simulator/6.1/Library/Safari/*.plist
info: Deleting /Users/pavithrank/Library/Application\ Support/iPhone\ Simulator/6.1/Library/WebKit/LocalStorage/*.*
info: Deleting /Users/pavithrank/Library/Application\ Support/iPhone\ Simulator/6.1/Library/Library/WebKit/GeolocationSites.plist
info: Deleting /Users/pavithrank/Library/Application\ Support/iPhone\ Simulator/6.1/Library/Cookies/*.binarycookies
info: Creating new appium session 879b4a92-7fb6-458b-897a-a9a051dec790
debug: No device id or app, not installing to real device.
info: Cleaned up instruments socket /tmp/instruments_sock
info: Not setting device type since we're connected to a device
debug: Creating instruments
info: instruments is: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info: [INSTSERVER] Instruments socket server started at /tmp/instruments_sock
info: Attempting to run app on real device with UDID UDIDVALUE
info: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Appium.app/Contents/Resources/node_modules/appium/app/uiauto/Automation.tracetemplate -w UDIDVALUE /tmp/Appium-MobileSafari.app -e UIASCRIPT /Applications/Appium.app/Contents/Resources/node_modules/appium/app/uiauto/bootstrap.js -e UIARESULTSPATH /tmp/appium-instruments/
info: And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/usr/lib/libgenkit.dylib"}
error: Instruments socket client never checked in; timing out
error: Instruments did not launch successfully, failing session
error: Failed to start an Appium session, err was: Instruments did not launch successfully--please check your app paths or bundle IDs and try again
info: Responding to client with error: {"status":6,"value":{"message":"A session is either terminated or not started","origValue":"Instruments did not launch successfully--please check your app paths or bundle IDs and try again"},"sessionId":"879b4a92-7fb6-458b-897a-a9a051dec790"}
POST /wd/hub/session 500 303283ms - 270
info: Clearing out appium devices
Thanks,
Pavithra
--
http://appium.io
---
You received this message because you are subscribed to a topic in the Google Groups "Appium-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/appium-discuss/XVIuzcd79zo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/groups/opt_out.
require 'selenium-webdriver'Following is my simple code which I am trying to execute.Thanks a ton for steps.Finally I could launch the safari on real device :)
APP_PATH = "/Users/use/Library/Developer/Xcode/DerivedData/SafariLauncher-eccrfyirwnmjdbgywjwkfakhwkzp/Build/Products/Debug-iphoneos/SafariLauncher.app"
capabilities = {
'browserName' => 'iOS',
'platform' => 'Mac',
'version' => '6.1',
'app' => APP_PATH
}
server_url = "http://127.0.0.1:4723/wd/hub"
@driver = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url)
Set<String> windowHandles = driver.getWindowHandles();
String nextWindowName = windowHandles.iterator().next();
driver.switchTo().window(nextWindowName);
driver.get("urlvalue");
Did you look into the github issue thread: https://github.com/appium/appium/issues/1083 [I have posted the issue what I get w.r.t safari launcher and appium developer suggests us to use webviewapp till the issue with safarilauncher gets resolved.]
I am using webviewapp (it doesnt launch safari) however it gives the same web view as in safari.
Pavithra !
--
--
DesiredCapabilities desiredCapabilities = new DesiredCapabilities(); desiredCapabilities.setCapability("device", "iPhone Simulator"); desiredCapabilities.setCapability("app", "webviewapppath along with .app");
URL url = new URL("http://127.0.0.1:4723/wd/hub"); RemoteWebDriver remoteWebDriver = new RemoteWebDriver(url, desiredCapabilities); //switch to the latest web view for(String winHandle : remoteWebDriver.getWindowHandles()){ remoteWebDriver.switchTo().window(winHandle); }
driver.get("urluwanttonavigate");
Language doesn't matter. I dont know how to set in other language other than java (that is what I mentioned).In above code: I could see you setting browserName as ios. Instead try with device => ipad simulator or iphone simulator. Thats the only difference I could see, but I am not sure whether that helps!
--
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class Test {
public static void main(String args[]) throws MalformedURLException, InterruptedException{
System.out.println("Pausing.. Manually switch to safari now..");
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("device", "iPhone Simulator");
desiredCapabilities.setCapability("app", "/Users/demo/Library/Developer/Xcode/DerivedData/WebViewApp-gwxcegwdeegpaabjdjrbhioayign/Build/Products/Debug-iphoneos/WebViewApp.app");
try {
URL url = new URL("http://127.0.0.1:4723/wd/hub");
RemoteWebDriver remoteWebDriver = new RemoteWebDriver(url, desiredCapabilities);
System.out.println("Pausing.. Manually switch to safari now..");
Thread.sleep(5000);
//switch to the latest web view
for(String winHandle : remoteWebDriver.getWindowHandles()){
remoteWebDriver.switchTo().window(winHandle);
}
remoteWebDriver.get("http://www.facebook.com");
Thread.sleep(5000);
} catch (WebDriverException e) {
System.out.println(e.getMessage());
}
}
}
If I run above code I get the following exception in eclipse console:-
A session is either terminated or not started (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 300.15 seconds
Build info: version: '2.35.0', revision: '8df0c6b', time: '2013-08-12 15:43:19'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.4', java.version: '1.6.0_51'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
What could be the problem? Do I need to increase the timeouts of webview app or something?
Thanks,
Rohit
public void setup() throws Exception
{
DesiredCapabilities cap = new DesiredCapabilities();
String myApp = "/Users/testing/Library/Developer/Xcode/DerivedData/SafariLauncher-coidnmjoofuxfnayfnsfoispntmz/Build/Products/Debug-iphoneos/SafariLauncher.app";
cap.setCapability("device", "ipad");
cap.setCapability("app", myApp);
cap.setCapability("version", "7.0.4");
driver = new RemoteWebDriver(new URL("http://localhost:4723/wd/hub"), cap);
System.out.println("connected1");
baseUrl= "http://www.google.com";
}
@After
public void tearDown() throws Exception
{
driver.quit();
}
@Test
public void test() throws Exception
{
for(String winHandle : driver.getWindowHandles()){
driver.switchTo().window(winHandle);
}
this.driver.get(baseUrl);
}
The following steps I have followed:
1. Started the ios-webkit-debug-proxy with the specific UDID
2.Opened and got into develop mode. Also checked the webinspector for mobile safari in device.
3. Launched appium server and run the test.
Please help me in getting solved and correct me where im wrong.
Thanks
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: We don't have write access to /Applications/Xcode.app/.....
info: Launching instruments
debug: Attempting to run app on real device with UDID e223246c1606a5bec52008a6b58919236cfc4a3f
debug: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w e223246c1606a5bec52008a6b58919236cfc4a3f /var/folders/n6/6_3mpqxn1bvgtmj1wdvrqs1wmrs8fk/T/114720-4499-iyd3z8/submodules/SafariLauncher/build/Release-iphoneos/SafariLauncher.app -e UIASCRIPT /Users/ksharma/Library/Application Support/appium/bootstrap/bootstrap-a1eb991c1f709a20.js -e UIARESULTSPATH /tmp/appium-instruments
debug: And extra without-delay env: {}
debug: And launch timeouts (in ms): {"global":90000}
debug: [INST] 2014-08-20 20:43:55 +0000 Fail: Could not start script, target application is not frontmost.
Instruments Trace Complete (Duration : 19.497269s; Output : /tmp/appium-instruments/instrumentscli0.trace)
debug: [INSTSERVER] Instruments exited with code 0
debug: Cleaning up after instruments exit
debug: Not worrying about instruments exit since we're using SafariLauncher
--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/d/optout.