Error after executing selenium with Chrome - selenium

I'm trying to execute Selenium with Chrome on Ubuntu 16.04 and what I do is:
Xvfb :10 -screen 0 1366x768x24 -ac &
google-chrome --remote-debugging-port=92222
When I execute the previous command I got this error:
vagrant#smart:~$ [2207:2332:1118/135124.679982:ERROR:bus.cc(394)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
DevTools listening on ws://127.0.0.1:9222/devtools/browser/39519bf4-dad5-4557-86d7-29bde71ee025
(google-chrome:2207): LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Unknown or unsupported transport 'disabled' for address 'disabled:'
[2207:2207:1118/135124.939100:ERROR:gpu_process_transport_factory.cc(980)] Lost UI shared context.
[1:8:1118/135125.063874:ERROR:command_buffer_proxy_impl.cc(100)] ContextResult::kFatalFailure: Shared memory region is not valid
I run the selenium command:
java -jar selenium-server-standalone-3.141.5.jar
And when I try to create a session manually through the url I got what I show in picture.
I'm trying to work with some test with codecpetion and yii2 but initially I can't because of that. I'm using the lastest version of all components and I was working perfectly until today. As well I have chromedriver. What is happening?. I am running in a vagrant box and I'm trying to test my application with codeception and I have tried to reinstall selenium and chrome and I got nothing, Thanks so much.

It is because of a conflict between chromedriver, selenium and chrome. Downgrading chrome, it's solved

Related

Host header or origin header is specified and is not localhost for selenium grid

I am trying to set up a selenium grid using the latest chrome and chromedriver. I get the following error when trying to run a test
Message: OpenQA.Selenium.WebDriverException : Unexpected error. Host header or origin header is specified and is not localhost.
On the node machine, I see the chrome browser open, but then it immediately closes and I get this error:
[1557513678.682][SEVERE]: Rejecting request with host: <hub_IP_address>:4444
Has anyone had this issue using the selenium grid? I am using:
selenium-server-standalone-4.0.0-alpha-1.jar and
Chromedriver 74.0.3729.6 for windows
My Chrome browser was running v.74.0.3729.108
JDK 12.0.1.0
Here is my command for starting the hub:
java -jar selenium-server-standalone-4.0.0-alpha-1.jar -role hub -hubConfig config.json
Here is my command to start a node:
java -Dwebdriver.chrome.driver="C:\...\Browsers\ChromeDirectory\chromedriver.exe" -Dwebdriver.ie.driver="C:\...\Browsers\IEDirectory\x86\IEDriverServer.exe" -jar -Dwebdriver.edge.driver="C:\...\Browsers\Edge\MicrosoftWebDriver.exe" -jar "C:\...\selenium-server-standalone-4.0.0-alpha-1.jar" -role node -hub "http://<hub_IP_address>:4444/grid/register/" -nodeConfig "C:\...\config.json"
I tried using a "host" property in the config.jsons. I tried putting the actual IP address and just localhost. But the hub and the node are obviously different machines, so putting localhost makes it so they can't connect. But when I dont have localhost, it says it needs to be specified as localhost? I'm so confused!! What is supposed to go in the host property?
I have seen people talk about a loopback property for protractor but I am not using protractor. I tried putting "loopback":true into both my node and hub config.json files but it doesn't seem to make a difference.
UPDATE:
I was able to get the grid to run successfully using the 4.0 alpha jar for the hub, and the old 3.8 jars for the nodes. All Still on Java 8. Kind of interesting.
You can try to add these switches: --whitelisted-ips --allowed-origins=''*
Try to run your node with command:
java -Dwebdriver.chrome.driver="C:\...\Browsers\ChromeDirectory\chromedriver.exe --whitelisted-ips --allowed-origins='*'" -Dwebdriver.ie.driver="C:\...\Browsers\IEDirectory\x86\IEDriverServer.exe" -jar -Dwebdriver.edge.driver="C:\...\Browsers\Edge\MicrosoftWebDriver.exe" -jar "C:\...\selenium-server-standalone-4.0.0-alpha-1.jar" -role node -hub "http://<hub_IP_address>:4444/grid/register/" -nodeConfig "C:\...\config.json"
I was able to get the selenium grid working by downgrading to 3.8.1 selenium grid jar and installing JDK 8 instead of 12. The reason I needed to get java 8 is answered in this other question. I used the same chrome driver and start up commands

chromium-browser Error: [670] Failed to put Xlib into threaded mode

my original aim was to run a headless selenium webdriver on a Raspberry Pi 3 (rasbian). After hours and hours of failing, I make a step back and now I only try to run chromium-browser which needed for the webdriver.
There... I recognize some errors after execute:
sudo ./chromium-browser --headless --no-sandbox --disable-gpu --disable-extensions
Error-Stack:
--disable-quic --enable-tcp-fast-open --disable-gpu-compositing --ppapi-flash-path=/usr/lib/chromium-browser/libpepflashplayer.so --ppapi-flash-args=enable_stagevideo_auto=0 --ppapi-flash-version=
[1015/183516.617458:ERROR:browser_main_loop.cc(670)] Failed to put Xlib into threaded mode.
[1015/183516.625190:ERROR:gpu_process_transport_factory.cc(1029)] Lost UI shared context.
I search for solution in internet but I found no results.
Following I have to add:
-everything works fine if run the webdriver on my windows system
-I reproduce the error on two complete different raspberry Pi's
-I also try to run on a Raspbian virtual machine
-I try to run the webdriver with iceweasel and geckodriver with the result "Error: connection refused"
So I am out of ideas, thankful for any response.
For others who are still struggling to find a solution:
It seems that the issue is with diplay resource when running the program on a remote server having multiple display.
You may try setting the DISPLAY environment parameter
export DISPLAY=:1.0;

Selenium+Jenkins+Chromedriver = WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally

I have problem with running my Selenium tests in Jenkins.
A result of execution is always:
WebDriverException: Message: unknown error: Chrome failed to start:
exited abnormally
My tests are written in Robot Framework and are using Chromium webdriver.
I'm setting needed paths in my command, which looks like this:
export PATH=$PATH:/usr/lib/chromium-browser; export PATH=$PATH:/usr/lib/chromium-browser/chromedriver; . /home/michal/robot_env/bin/activate; robot -L TRACE /home/michal/project_robot/tests
And when I run this command manually in terminal IT WORKS fine (Chromium starts automatically and the test goes on).
So the problem suppose to be in Jenkins. I have installed Xvfb plugin, but it didn't help.
Additionally, in /etc/init.d/jenkins I put these lines:
/usr/bin/X :0 vt7 -ac
export DISPLAY=:0
xhost +
And once again - nothing changed. What else should I set or check?
i got stuck same way.
The problem is that jenkins has it own user, called jenkins, and jenkins user cannot open the browser.
if you try to make "su jenkins" and then "chromium-browser" you obtain the display error.
That because you obtain this issue. The problem is not the webdriver, the problem is the user.
i removed the jenkins user created by jenkins and i createad a normal user called jenkins before installing jenkins.
then i installed jenkins.
now jenkins user can run the test (because it can open the browser) but jenkins itself will not load anymore.

Web Driver Curl Exception

Trying to use Codeception Web Driver and Selenium to emulate ajax through an acceptance test. I was using PhpBrowser but when I was having issues with Ajax my friend suggested WebDriver.
After enabling it and downloading the selenium (and running it) I get the following error.
[WebDriverCurlException]
Curl error thrown for http POST to http://127.0.0.1:4444/wd/hub/session
with params: {"desiredCapabilities":{"browserName":"googlechrome"}}
Failed to connect to 127.0.0.1 port 4444: Connection Refused
I made sure I was running selenium on port 4444.
java -jar selenium-server.jar -port 4444
acceptance.suite.yml below
class_name: AcceptanceTester
modules:
enabled:
- WebDriver
- REST
config:
WebDriver:
url: 'http://life1605.dev'
browser: googlechrome
REST:
url: 'http://life1605.dev'
I had the same problem, with the exact same error message. For some strange reason, it looked like starting the selenium server from command line did not work.
My solution turned out to be manually opening the selenium server through Windows Explorer, right click on the file, choose Open with -> Java Platform SE Binary.
Took me almost 3 hours to figure it out, so I hope this helps somebody.
I had this problem and it turned out a new version of Firefox was incompatible with the addon that Selenium uses to communicate with Firefox.
When you start your tests you should see the new Firefox window appear, and have 30 seconds or so before it goes away again. Within this time, if you type about:addons into the URL field and then click on "Extensions", you should see the "Firefox WebDriver" addon there, and it should be enabled.
For me it was disabled as it was incompatible with the latest Firefox version. So the solution in this case was to either downgrade Firefox or wait for an updated Selenium.
Note that the addon is only installed in the Firefox instance under test, so you won't see it when you use Firefox outside of Selenium.
I had this same problem, I forgot to run phantom.js before trying to do any browser tests. I ran phantomjs and it worked.
I had this problem, and then I remembered that I need to run Xvfb -ac :0 -screen 0 1280x1024x16 & after every Homestead reload (before running Dusk tests).
Then Dusk works instead of saying:
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown
for http POST to /session with params:
{"desiredCapabilities":{"browserName":"chrome","platform":"ANY"}}
Operation timed out after 30000 milliseconds with 0 bytes received
See https://stackoverflow.com/a/42630737/470749

Chrome Driver Error using Selenium: Unable to Discover Open Pages

I'm getting a Chrome Driver related error when running my Selenium tests. The error message is "Unable to Discover Open Pages." The Selenium tests were all running fine until last evening. The problem seemed to begin after a reboot of the server the day before. I cannot reproduce this error on my local box. Running the Selenium tests from the command line on the server does open the Chrome Browser but results in the same error. Any ideas?
Line that is failing:
chromeDriver = new OpenQA.Selenium.Chrome.ChromeDriver(externalDriverPath);
Error message and stacktrace:
unable to discover open pages (Driver info:
chromedriver=2.1,platform=Windows NT 6.1 SP1 x86_64) at
OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response
errorResponse) at
OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String
driverCommandToExecute, Dictionary`2 parameters) at
OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities
desiredCapabilities) at
OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor
commandExecutor, ICapabilities desiredCapabilities) at
OpenQA.Selenium.Chrome.ChromeDriver..ctor(String
chromeDriverDirectory, ChromeOptions options) at
OpenQA.Selenium.Chrome.ChromeDriver..ctor(String
chromeDriverDirectory) at SeleniumTests.BaseTest.SetupBrowsers()
When creating an instance of the ChromeDriver, a console window appears. The server with the error seems to refer to things NOT IMPLEMENTED.
ChomeDriver Output From the Server with the Error:
Started ChromeDriver (v2.1) on port 2984
[4700:4292:0108/111503:ERROR:gpu_info_collector_win.cc(102)] Can't
retrieve a va lid WinSAT assessment.
[4700:4292:0108/111503:ERROR:chrome_views_delegate.cc(176)] NOT
IMPLEMENTED
[4700:4292:0108/111503:ERROR:desktop_root_window_host_win.cc(746)] NOT
IMPLEMENT ED [0108/111504:ERROR:gl_surface_egl.cc(132)] eglInitialize
failed with error UNKNO WN [0108/111504:ERROR:gl_surface_win.cc(97)]
GLSurfaceEGL::InitializeOneOff failed.
ChomeDriver Output From My PC which works fine:
Started ChromeDriver (v2.1) on port 18786
[884540:883760:0108/114010:ERROR:gpu_info_collector_win.cc(102)] Can't
retrieve a valid WinSAT assessment.
[884992:884996:0108/114010:ERROR:base_feature_provider.cc(122)]
manifestTypes: A llowing web_page contexts requires supplying a value
for matches.
[885232:885236:0108/114011:ERROR:base_feature_provider.cc(122)]
manifestTypes: A llowing web_page contexts requires supplying a value
for matches.
[884540:883760:0108/114011:ERROR:base_feature_provider.cc(122)]
manifestTypes: A llowing web_page contexts requires supplying a value
for matches. [0108/114011:ERROR:gl_surface_egl.cc(131)] eglInitialize
failed with error UNKNO WN [0108/114011:ERROR:gl_surface_win.cc(54)]
GLSurfaceEGL::InitializeOneOff failed.
You are using a highly outdated version of the ChromeDriver. Your first port of call should be to update it here.
I would highly suspect the problem is your Chrome on your server has updated, and ChromeDriver v2.1 doesn't support any recent versions of Chrome.
Look here for other possible solutions: https://groups.google.com/forum/?hl=en#!topic/selenium-users/gfvfH-YEC48
In my case, adding the --no-sandbox argument to ChromeOptions solved the problem.
Here's a quick workaround I found while digging around to get rid of that error: unknown error: unable to discover open pages
In your protractor config file, add the following:
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['--no-sandbox']
}
},
The most important line there is the --no-sandbox; adding that line somehow gets rid of that error.
I am not exactly sure why it works but it's a workaround I found while digging around online.
***********************************UPDATES as of 10/04/2016***********************************
Please ignore this part right above as that workaround is NOT a proper fix; below I show you the actual fix to your problem; you just have an outdated chrome driver and running "webdriver-manager update" will only update up to v2.22 so I'll show you how to grab v2.24 right below.
Read on if your webdriver-manager update doesn't update chromedriver
to the latest i.e past v2.22 OR to v2.24 as of 10/04/2016.
I lost a few weeks pulling my hair around an issue I had with "Unable to discover open pages" and every time I would update the chromedriver, it would update to version 2.22 for chromedriver and I believe the selenium server to v2.53.
My problem wasn't really with the selenium server so v2.53 was fine.
Issue was with chromedriver v2.22.
Eventhough this chromdriver link showed that there was a latest version of 2.24, 'webdriver-manager update' would NOT pick up that latest version, it would only grab version 2.22 of the chrome driver.
How did I go around this?
Simply run the command below after you check this link for which version of chromedriver you want to update to; for instance, I wanted v2.24 so I ran the command below:
webdriver-manager update --versions.chrome 2.24
If you check your location: C:\Users\<USER>\AppData\Roaming\npm\node_modules\webdriver-manager\selenium\
You should see that the desired chromedriver was downloaded there; if it's not there, read the command prompt logs and it'll tell you where it downloaded your chromdriver files.
Hope that helps someone!
I had the same problem, but updating to the latest ChromeDriver (v2.8) did not solve it for me. I was running Selenium on a CI server (A Dell machine running 64 bit Win 7). I got the exception every time when the server had been 'idle' for a while.
What fixed the problem for me was to set 'Turn off display after' in Windows' Power Options to 'Never'.
I am running selenium with python in Docker on a Google compute instance. For me, the issue was that my instance didn't have enough memory, and my scrape job would fail with this error. Upgrading it to g1-small resolved the issue for me.
In my case the problem was due to one of my colleagues, who started his tests at the same time on the same server, so that my web driver could not access the Chrome executable. It also happens if someone didn't finish his web driver process properly, in this case you have to kill it manually.
First make sure you have updated you chrome browser, through the Menu UI.
Then update ChromeDriver, here.
For some reason the Chrome driver cannot interpret https traffic. If you change your link to http it will work nicely.