I am using below code to launch the url. But not loading the url.
WebDriverManager.chromedriver().setup();
ChromeOptions option = new ChromeOptions();
option.
addArguments("user-data-dir=C:\\Users\\vkandukur.ctr\\AppData\\Local\\Google\\Chrome\\User Data\\"
);
option.addArguments("--profile-directory=Profile 6");
option.addArguments("--incognito");
WebDriver driver = new ChromeDriver(option);//in selenium4
driver.get("https://peter.sh/experiments/chromium-command-line-switches/");
Getting exceptions:
Starting ChromeDriver 105.0.5195.52 (412c95e518836d8a7d97250d62b29c2ae6a26a85-refs/branch-heads/5195#{#853}) on port 53422
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 400. Message: invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
Build info: version: '4.4.0', revision: 'e5c75ed026a'
System info: host: 'INL1TBH6G3', ip: '192.168.43.148', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '18.0.1.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [user-data-dir=C:\Users\vkan..., --profile-directory=Profile 6, --incognito], extensions: []}}], desiredCapabilities=Capabilities {browserName: chrome, goog:chromeOptions: {args: [user-data-dir=C:\Users\vkan..., --profile-directory=Profile 6, --incognito], extensions: []}}}]
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:144)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:102)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:547)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:157)
at org.openqa.selenium.chromium.ChromiumDriver.(ChromiumDriver.java:101)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:81)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:70)
at com.ironMountain.util.browserConfiguration.ChromeBrowser.main(ChromeBrowser.java:104)
can any one help please
Related
System.InvalidOperationException : Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: Process unexpectedly closed with status 0
Build info: version: '4.1.2', revision: '9a5a329c5a'
System info: host: 'a9efa94d3168', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-1052-aws', java.version: '11.0.13'
Driver info: driver.version: unknown
I have seen other articles referencing this error and they state that the Chrome driver version and the browser version must be the same. I am using WebDriverManager, which is supposed to ensure that they are the same.
I am running the code in a Gitlab pipeline - it is running in a docker container on Linux.
I only get this error occasionally. If it was a problem with my code set up I would expect to get it on every run.
I am trying to run a simple program using Selenium Grid(have no prior knowledge of selenium grid), and I am having error shown as below:
Exception in thread "main" 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: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'DEL1-LTC1X3PH2', ip: '192.168.0.101', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171'
Driver info: driver.version: RemoteWebDriver
Below is my sample code:
String URL = "http://www.DemoQA.com";
String Node = "http://192.168.1.164:4444/wd/hub";
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setBrowserName("firefox");
//cap.setPlatform(Platform.WIN10);
driver = new RemoteWebDriver(new URL(Node), cap);
driver.navigate().to(URL);
Thread.sleep(5000);
driver.quit();
Can someone please explain why this error is coming, and any reference from where I can get to know more about selenium grid.
This error looks like it's occurring because you don't have a Selenium Grid running with a hub at the URL you provided. You need to start the grid yourself, Selenium won't start it for you the way it will start up a single session. You can use docker and docker-compose to start your grid using the instructions here.
You can find more information about Selenium Grid here.
Also, rather than use
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setBrowserName("firefox");
you can condense to one line and use
DesiredCapabilities cap = DesiredCapabilities.firefox();
to set up your DesiredCapabilities.
I am just upgrading to selenium-server-standalone-3.0.1 on our Selenium Grid hub and on the nodes.
What I realised is, that the JSON config has slightly changed (https://github.com/SeleniumHQ/selenium/wiki/Grid2).
After changing my configuration accordingly the node is starting fine. However I can not run any tests on firefox because I get the following error:
Exception: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: VISTA
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'ebc-vie-selenium-node-01', ip: '10.100.0.157', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_71'
Driver info: driver.version: FirefoxDriver
The JSON configuration looks like this:
"capabilities":
[
{
"browserName": "firefox",
"version": "49.0.2",
"platform": "WINDOWS",
"firefox_binary": "C:\\Program Files (x86)\\Mozilla Firefox\\ESR\\Firefox_49.0.2\\firefox.exe",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
When I set the firefox_binary directly from Java code it works fine (with Gecko Driver)
desiredCapabilities.setCapability("firefox_binary", "C:\\\\Program Files (x86)\\\\Mozilla Firefox\\\\ESR\\\\Firefox_49.0.2\\\\firefox.exe");
Any idea why that is happening respectively how the JSON configuration has changed for version 3.0.1
I am getting the following error on resetting the app [driver.resetApp()] and on launching the app on Appium (version: 1.4.16.1). I am using Java.
Eclispe console
org.openqa.selenium.WebDriverException: chrome not reachable
(Session info: chrome=50.0.2661.86)
(Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.08 seconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'IN2084073W1', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_21'
*** Element info: {Using=id, value=password}
Session ID: 2968b7e9-948e-4b75-94ed-838d10a08c82
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{platform=LINUX, app=C:/apk/appname.apk, javascriptEnabled=true, appActivity=.MainActivity, browserName=, networkConnectionEnabled=true, desired={newCommandTimeout=120, app=C:/apk/surveyorapp.apk, platformVersion=5.1, deviceName=TA93303Q2F, platformName=Android, appActivity=.MainActivity, browserName=, appPackage=com.axa.surveyorapp}, locationContextEnabled=false, appPackage=com.axa.surveyorapp, newCommandTimeout=120, platformVersion=5.1, databaseEnabled=false, deviceName=TA93303Q2F, platformName=Android, webStorageEnabled=false, warnings={}, takesScreenshot=true}]
Appium Log
error: Could not proxy command to remote server. Original error: Error: read ECONNRESET
error: Chromedriver: Chromedriver exited unexpectedly with code 3221225477, signal null
info: Chromedriver: Changed state to 'stopped'
warn: Chromedriver for context WEBVIEW_com.clientname.appname stopped unexpectedly
error: Chromedriver quit unexpectedly during session
Update
Thanks for the update Emna. I have tried your option.
Can you please let me know how exactly I need to add this. I am using AndroidDriver not AppiumDriver. I have tried with both, but I'm getting below error.
Try to use :
(AppiumDriver)driver.resetApp();
Instead of :
driver.resetApp();
You can have a look into this link: Appium java-client
and use this link also to download ;)
I'm trying to solve it for days, please help me!
I'm running my protractor tests using chrome, firefox and internet explorer, but when I try to run the same test in Safari, I get the following error:
ScriptTimeoutError: Timed out awaiting response to command "executeScript" after 30003 ms (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30.08 seconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'myPC', ip: '192.168.0.12', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities [{browserName=safari, takesScreenshot=true, javascriptEnabled=true, version=5.1.7, cssSelectorsEnabled=true, platform=WINDOWS, secureSsl=true}]
Session ID: null
The error comes when I try to get some url like browser.get('https://www.google.com'); I tried to run the same test in Safari in my colleague's macbook to see if the problem is my windows environment (and the older safari version 5.1.7) but had the same problem. I also tried to change the allScriptsTimeout and got the same problem, I tried many different configurations in my protractor configuration file and it didn't worked =(
I'm sure that I"m doing something wrong but have no ideia about what... I didn't found more information about this error.
Edit: There is a known issue (https://github.com/angular/protractor/issues/2111) about using protractor with safari