I am trying to run the appium script on mac but facing the issue when running the script. Details are mentioned below:
Configuration:
OS: 10.13.6
xcode: 9.4.1
Simulator : iPhone 7
Java_client jar = 6.1.0
Okhttp jar = 3.9.1
httpclient jar = 4.5.3
appium server = 1.8.1
Steps:
I have added the following desired capabilities in my script:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 7");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.IOS_XCUI_TEST);
capabilities.setCapability(MobileCapabilityType.APP, "/Users/synerzip/Desktop/emulator/Concishare Provider.app");
capabilities.setCapability("usePrebuiltWDA", false);
capabilities.setCapability("clearSystemFiles", true);
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "iOS");
capabilities.setCapability(MobileCapabilityType.AUTO_WEBVIEW, true);
IOSDriver driver = new IOSDriver(new URL("http://0.0.0.:4723/wd/hub"), capabilities);
Error:
When I am trying to run it, it is displaying the following error:
Exception in thread "main" org.openqa.selenium.WebDriverException: It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z'
System info: host: 'syn-macmini-03.synerzipune.local', ip: '2001:df0:d300:212:a155:8262:1823:7137%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_171'
Driver info: driver.version: IOSDriver
I have added the java client jar with version '5.0.0' but still getting the same error
Related
Hi people: I have the next situation.
I want to run automation with Selenium, specifically with Microsoft Edge on Mac.
I have installed Version 77.0.235.15 (Official build) Beta (64-bit)
Edgedriver: Version: 77.0.235.15
The rest of the browsers run with no drama, but Edgedriver fails.
System.setProperty("webdriver.edge.driver", Constants.EdgeDriverPath);
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setBinary(Constants.EdgeDriverPath);
EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions);
driver = new EdgeDriver(edgeOptions);
The error is the next:
Caused by: org.openqa.selenium.WebDriverException: unknown error: Microsoft Edge failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from MicrosoftEdge location src/test/resources/drivers/mac/msedgedriver is no longer running, so MSEdgeDriver is assuming that Microsoft Edge has crashed.)
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: 'CL-IT00331', ip: '192.168.0.12', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.3', java.version: '1.8.0_211'
Driver info: driver.version: EdgeDriver
remote stacktrace: 0 msedgedriver 0x000000010bc29f99 msedgedriver + 8023961
Could you please help me?
I'm using a macOS, I installed the Edge webdriver on it, configured its path on my selenium framework
But I got this error:
org.openqa.selenium.WebDriverException: unknown error: cannot find Microsoft Edge binary
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'MacBook-Pro-de-Sabrine-2.local', ip: 'fe80:0:0:0:4c2:e6bc:d2ff:348c%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.5', java.version: '1.8.0_191'
Driver info: driver.version: EdgeDriver
So you are using MAC. The problem is that the browser needs to be installed on your system in order to run it.
So if somehow you have installed it use the below code:
Code:
System.setProperty("webdriver.edge.driver","/YOUR_PATH");
WebDriver driver = new EdgeDriver();
driver.get("http://www.google.com");
OR
System.setProperty("webdriver.edge.driver","YOUR_PATH");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setBinary("/YOUR_PATH");
EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions);
WebDriver driver = new EdgeDriver(edgeOptions);
driver.get("http://www.google.com");
I am using below code to launch android driver. But I am getting error at the time of launching the driver.
On line:
driver = new AndroidDriver<WebElement>(new URL(appiumServiceUrl), capabilities);
Complete Code:
public class Test {
protected static AppiumDriver<WebElement> driver;
private AppiumDriverLocalService appiumService;
private String appiumServiceUrl;
Properties prop = new Properties();
#org.testng.annotations.Test
public void testappiumdriver() throws FileNotFoundException, IOException
{
appiumService = AppiumDriverLocalService.buildDefaultService();
appiumService.start();
appiumServiceUrl = appiumService.getUrl().toString();
prop.load(new FileInputStream("device_capabilities.properties"));
Map<String, String> prop_map = new HashMap<String, String>();
for (String key : prop.stringPropertyNames()) {
prop_map.put(key, prop.getProperty(key));
}
DesiredCapabilities capabilities = new DesiredCapabilities(prop_map);
driver = new AndroidDriver<WebElement>(new URL(appiumServiceUrl), capabilities);
}
}
Error:
FAILED: testappiumdriver
org.openqa.selenium.WebDriverException: It is impossible to create a new session because 'createSession' which takes HttpClient,
InputStream and long was not found or it is not accessible
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:24:21.231Z'
System info: host: 'PSL-GGN-597', ip: '192.168.2.137', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version:
'1.8.0_91'
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:195)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:209)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:231)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
at
io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession
at org.openqa.selenium.remote.RemoteWebDriver.
(RemoteWebDriver.java:130)
at io.appium.java_client.DefaultGenericMobileDriver.
(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:84)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:94)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:93)
at test.Test.testappiumdriver(Test.java:37)
I am using below jars in my project:
selenium-java 3.13
selenium-server 3.13
java-client 6.1.0
I have also tried with different version of selenium and java-client but again getting same error.
****Solution 1st****
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "xyz");
capabilities.setCapability("platformVersion", "6.0");
capabilities.setCapability("platformName", Platform.ANDROID);
capabilities.setCapability("appPackage", "com.hp.HPSupportAssistant");
capabilities.setCapability("appActivity", "com.hp.HPSupportAssistant.MainActivity");
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 6000); capabilities.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS,true);
//desiredCap.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2);
Here comment below line and then run it will work
desiredCap.setCapability(MobileCapabilityType.AUTOMATION_NAME,AutomationName.ANDROID_UIAUTOMATOR2);
solution 2nd
Or keep above line in desired capabilities but before that do
run 3 cmd on cmd promt
adb shell pm list packages -f > D://t.txt
adb uninstall io.appium.uiautomator2.server
adb uninstall io.appium.uiautomator2.server.test
desiredCap.setCapability(MobileCapabilityType.AUTOMATION_NAME,AutomationName.ANDROID_UIAUTOMATOR2);
This error message...
org.openqa.selenium.WebDriverException: It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:24:21.231Z'
System info: host: 'PSL-GGN-597', ip: '192.168.2.137', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
Driver info: driver.version: AndroidDriver
...implies that the AndroidDriver was unable to initiate/spawn a new session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
Your JDK version is 1.8.0_91 which is pretty ancient.
Solution
Upgrade JDK to recent levels JDK 8u191.
Take a System Reboot.
Execute your #Test.
Selenium 3.0 Firefx Driver fails with org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session.
System.setProperty("webdriver.gecko.driver", "..<Path>../geckodriver.exe");
capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
driver = new FirefoxDriver(capabilities);
Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions#23aa363a, browserName=firefox, moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions#23aa363a, version=, platform=ANY}], required capabilities = Capabilities [{}]
Build info: version: '3.0.0', revision: '350cf60', time: '2016-10-13 10:48:57 -0700'
System info: host: 'D202540', ip: '10.22.19.193', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:259)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:247)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:242)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:135)
this issue is solved with geckodriver 0.15 and selenium 3.3 version.
You need to download geckodriver. And then set
System.setProperty("webdriver.gecko.driver", "path\\to\\geckodriver.exe")
Check this link.
I had the same problem and fixed it with this. It seems it could not find the firefox binary
capabilities.setCapability("firefox_binary","C:\\Program Files\\Mozilla Firefox\\firefox.exe");
Same problem here. It was solved opening Eclipse/Netbeans with admin privileges.
This worked (linux mint, opensuse thumbleweed, win7)
with
libraryDependencies += "org.seleniumhq.selenium" %
"selenium-firefox-driver" % "3.0.1"
geckodriver.exe -V
geckodriver 0.13.0
if (System.getProperty("os.name").toLowerCase().contains("linux")) {
println("загружены настройки os.name=linux")
System.setProperty("webdriver.chrome.driver", "bin/chromedriver")
System.setProperty("webdriver.gecko.driver", "bin/geckodriver")
}else{
System.setProperty("webdriver.chrome.driver", "bin\\chromedriver.exe")
System.setProperty("webdriver.gecko.driver", "bin\\geckodriver.exe")
System.setProperty("webdriver.ie.driver", "bin\\IEDriverServer.exe")
System.setProperty("webdriver.edge.driver", "C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe")
System.setProperty("webdriver.opera.driver", "c:\\XXX\\operadriver.exe")
System.setProperty("webdriver.opera.path","""C:\\Users\\user\\AppData\\Local\\Programs\\Opera""")
System.setProperty("webdriver.opera.binary","""C:\\Users\\user\\AppData\\Local\\Programs\\Opera\\launcher.exe""")
//
}
...
case
"firefox" => {
println(" подгружаем Веб-драйвер: geckodriver")
//iniprofile = new ProfilesIni()
//ffprofile = iniprofile.getProfile("default")
dc = DesiredCapabilities.firefox()
dc.setCapability("gecko", true) // как выйдет драйвер, так и установить
// dc.setCapability(FirefoxDriver.PROFILE, ffprofile); //FirefoxDriver.PROFILE = “firefox_profile”;
remote = new FirefoxDriver(dc)
}
but, for Remotewebdriver-connection if previous session failed,cancelled or aborted we get error:
[info] XXXX.E011_WebDB6292 *** ABORTED ***
[info] org.openqa.selenium.SessionNotCreatedException: Session is already started (WARNING: The server did not provide any stacktrace information)
[info] Command duration or timeout: 0 milliseconds
[info] Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
[info] System info: host: 'XXXX', ip: '172.16.4.125', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_11'
[info] Driver info: driver.version: RemoteWebDriver
[info] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
I ran into the same problem today, and it appears that not being admin on my laptop is actually an issue. To resolve it
Install in a non admin way Firefox (just need to click on no when Windows ask for privilege elevation)
Use the exe path (for my system something like C:\\Users\\MyUserName\\AppData\\Local\\MozillaFirefox\\firefox.exe).
It actually solved the issue.
Alternatively if you dont want to download the Gecko driver, you can downgrade the Firefox version to 44.
https://support.mozilla.org/t5/Install-and-Update/Install-an-older-version-of-Firefox/ta-p/1564
If you are using the latest GekoDriver then better to update the Selenium library versions as well.
The above issue is related to the Selenium version.
I am using Firefox 47.0.1 with Marionette driver geckodriver-v0.8.0-win32. But I got unreachable browser exception and firefox not opening.
My code snippet looks like below :
System.setProperty("webdriver.gecko.driver", "C:/Documents and Settings/Admin/Desktop/wires-0.6.2-win/wires.exe");
GeckoDriverService service = new GeckoDriverService(new File("C:/Documents and Settings/Admin/Desktop/wires-0.6.2-win/wires.exe"), PortProber.findFreePort(), null, null);
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability("marionette", true);
cap.setCapability("firefox_binary", "G:/Program Files/Mozilla Firefox/firefox.exe");
driver = new MarionetteDriver(service, cap,PortProber.findFreePort());
showing exception as :-
org.openqa.selenium.remote.UnreachableBrowserException: Could not
start a new session. Possible causes are invalid address of the remote
server or browser start-up failure.
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40'
System info: host: 'computer_1', ip: '192.168.1.100', os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version:
'1.7.0_79'
Driver info: driver.version: MarionetteDriver
There is no need for renaming geckodriver.exe to wires.exe. And usage of GeckoDriverService is not needed. With the stable release they've simplified the coding. Just download GeckoDriver and use it like
System.setProperty("webdriver.gecko.driver", "path\\to\\geckodriver.exe");
DesiredCapabilities caps = DesiredCapabilities.firefox();
caps.setCapability(FirefoxDriver.BINARY, "G:\\Program Files\\Mozilla Firefox\\firefox.exe");
WebDriver driver = new MarionetteDriver(caps);
I'm assuming, you are using selenium 3.0 beta2. Here is the solution:
System.setProperty("webdriver.gecko.driver","C:\\geckodriver.exe"); //change geckodriver path accordingly.
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
webDriver = new MarionetteDriver(capabilities);
Please download latest geckodriver from https://github.com/mozilla/geckodriver/releases.