use normal browser profile as selenium profile - selenium

my os is Ubuntu 16.04, the default chrome profile is in :
~/.config/google-chrome
so i setup my selenium option with :
options.add_argument("--user-data-dir=/home/user/.config/google-chrome")
but no luck, the error message :
Message: unknown error: Chrome failed to start: exited abnormally

Related

UnexpectedAlertPresentException: Alert Text: error: Message: unexpected alert open: {Alert text : error:} Python

I am running a selenium script on EC2 amazon linux 2, which run well, but after many hours of it doing it's job, I get the following error:
selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: error:
Message: unexpected alert open: {Alert text : error:}
(Session info: headless chrome=103.0.5060.114)
I am using ChromeDriverManager
How can I know why it fail after long time of running well?

The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

I get the following error when I run this command on headless ubuntu 20.04
selenium-side-runner -c "browserName=chrome chromeOptions.args=[disable-infobars, headless]" myproject.side
info: Running Mynew.side
FAIL MySuiteOne/MytestOne.test.js
● Test suite failed to run
WebDriverError: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
at Object.throwDecodedError (../../usr/lib/node_modules/selenium-side-runner/node_modules/selenium-webdriver/lib/error.js:550:15)
at parseHttpResponse (../../usr/lib/node_modules/selenium-side-runner/node_modules/selenium-webdriver/lib/http.js:560:13)
at Executor.execute (../../usr/lib/node_modules/selenium-side-runner/node_modules/selenium-webdriver/lib/http.js:486:26)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.255s
Ran all test suites.
My Chrome version:91.0.4472.77 installed in /usr/bin/google-chrome
Chrome driver version: chromedriver#90.0.1
I also tried commands
selenium-side-runner /path/to/your-project.side
selenium-side-runner -c "browserName=chrome chromeOptions.args=[headless, no-sandbox, disable-dev-shm-usage, disable-infobars] chromeOptions.binary='/usr/bin/google-chrome'" Mynew.side
But still, I am facing the same error. Is there any way to fix this. I am trying to configure selenium in Ubuntu 20.04 Amazon EC2 instance.
Per the Chromedriver Download page,
If you are using Chrome version 91, please download ChromeDriver 91.0.4472.19

Selenium error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist)

options = Options()
options.add_argument('use-fake-device-for-media-stream')
options.BinaryLocation = "/usr/bin/chromium-browser"
driver = webdriver.Chrome(executable_path="/usr/bin/chromedriver",options=options)
On executing the above with sudo python3 script_name.py, the following errows shows up:
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /snap/chromium/current/command-chromium.wrapper is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
The above error doesnt show up on executing python3 script_name.py, I believe that has to do something with the display.
Please let me know how I can resolve this.
Other details:
Chromium version: 85.0.4183.83
Selenium version:3.141.0
Chrome webDriver version: 85.0.4183.83

Jenkins run causes Selenium tests to fail with org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally?

I'm running Selenium tests for Chrome through Jenkins pipeline on CentOs machine. When ran, it gives following error -
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
[testng] (unknown error: DevToolsActivePort file doesn't exist)
[testng] (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
However if I run same tests with same command(which is used through Jenkins pipeline) from that machine locally, it succeeds.
For the same, I went through link1, link2, link3 and other answers. From those answers, only following helped -
chrome_options.add_argument('--headless')
But this run tests with chrome in headless mode which is not my intention.
In my case, having matching Chrome browser and chromedriver version did not help, also Chrome has executable permission for all.
Note: I've my CentOs machine display enabled
Could you please help to understand what is causing this failure? Also please help with what code and/or machine level changes I've to make for its success.
EDIT:
In case, this helps to get more info.
ls | grep 'chrome' under /usr/bin gave following result -
lrwxrwxrwx 1 root root 31 Jan 20 12:29 google-chrome -> /etc/alternatives/google-chrome
lrwxrwxrwx 1 root root 32 Jan 20 12:29 google-chrome-stable -> /opt/google/chrome/google-chrome
Do you run chromedriver locally on a linux machine? What version of CentOS are you using? If you haven't already you need to install the correct chromedriver for linux. As far as I know if you want to run via Jenkins you have to run in headless mode. But I may be wrong. Below is another post that can help:
Steps to Install and run headless chrome browser on centos 6.5 using chrome driver
Below are my own settings for chrome options:
options.addArguments("--headless");
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--allow-insecure-localhost");
options.addArguments("--window-size=1920,1080");
options.addArguments("start-maximized");
options.addArguments("enable-automation");
options.addArguments("--disable-infobars");
options.addArguments("--disable-browser-side-navigation");
options.addArguments("--disable-gpu");
options.addArguments("--no-sandbox");
options.addArguments("--force-device-scale-factor=1");

How lo launch test in safari with intern js and selenium grid

I’m testing with internJs, I want to launch tests in safari browser:
hub machine: Windows 8.1
node machine: Mac Os X El Capitan Version 10.11.6 === Safari version: 10.1.1
In the hub i run:
java –jar selenium-server-standalone-3.4.0.jar –role hub
In the node machine i run:
java –jar selenium-server-standalone-3.4.0.jar –role webdriver –hub http://192.168.1.2:4444/grid/register -port 5566
Also I installed SafariDriver.safariextz
error:
C:\dev\E2E_Test_WebTv>intern-runner config=tests/intern
Listening on 0.0.0.0:9000
Tunnel started
Suite safari on MAC FAILED
UnknownError: [POST http://localhost:4444/wd/hub/session /
{"desiredCapabilities
":{"selenium-server-standalone":"3.4.0","name":"tests/intern","idle-
timeout":60,
"browserName":"safari","platform":"MAC"}}] Error forwarding the new session
Empt y pool of VM for setup Capabilities [{name=tests/intern,
browserName=safari, idl e-timeout=60, selenium-server-standalone=3.4.0,
platform=MAC}] at Server.createSession
users\Test\AppData\Roaming\npm\node_modules\in
tern\node_modules\leadfoot\Server.js:355:15>
at
<..\..\Users\Test\AppData\Roaming\npm\node_modules\intern\lib\executors\Run
ner.js:198:23>
at retry
<..\..\Users\Test\AppData\Roaming\npm\node_modules\intern\lib\util.j
s:818:13>
at
<..\..\Users\Test\AppData\Roaming\npm\node_modules\intern\node_modules\dojo
\Promise.ts:393:15>
at runCallbacks
<..\..\Users\Test\AppData\Roaming\npm\node_modules\intern\nod
e_modules\dojo\Promise.ts:11:11>
at
<..\..\Users\Test\AppData\Roaming\npm\node_modules\intern\node_modules\dojo
\Promise.ts:317:4>
at run
<..\..\Users\Test\AppData\Roaming\npm\node_modules\intern\node_modules
\dojo\Promise.ts:237:7>
at
<..\..\Users\Test\AppData\Roaming\npm\node_modules\intern\node_modules\dojo
\nextTick.ts:44:3>
at _combinedTickCallback <internal\process\next_tick.js:73:7>
at process._tickCallback <internal\process\next_tick.js:104:9>
TOTAL: tested 0 platforms, 0/0 tests failed; fatal error occurred
Error: Run failed due to one or more suite errors
at emitLocalCoverage
<..\..\Users\Test\AppData\Roaming\npm\node_modules\inter
n\lib\executors\Executor.js:363:18>
at finishSuite
<..\..\Users\Test\AppData\Roaming\npm\node_modules\intern\lib\
executors\Executor.js:380:15>
at
<..\..\Users\Test\AppData\Roaming\npm\node_modules\intern\lib\executors\Exe
cutor.js:388:8>
at
<..\..\Users\Test\AppData\Roaming\npm\node_modules\intern\browser_modules\d
ojo\Promise.ts:393:15>
at runCallbacks
<..\..\Users\Test\AppData\Roaming\npm\node_modules\intern\bro
wser_modules\dojo\Promise.ts:11:11>
at
<..\..\Users\Test\AppData\Roaming\npm\node_modules\intern\browser_modules\d
ojo\Promise.ts:317:4>
at run
<..\..\Users\Test\AppData\Roaming\npm\node_modules\intern\browser_modu
les\dojo\Promise.ts:237:7>
at
<..\..\Users\Test\AppData\Roaming\npm\node_modules\intern\browser_modules\d
ojo\nextTick.ts:44:3>
at _combinedTickCallback <internal\process\next_tick.js:73:7>
at process._tickCallback <internal\process\next_tick.js:104:9>