Couldn't connect to selenium server to execute a webdriverIO test - selenium

i,m having a runtime error when i execute a webdriverIO test by console.
this is the error Couldn't connect to selenium server to execute a webdriverIO test.
I can access to my selenium server by browser (http://localhost:4444/wd/hub/static/resource/hub.html) but its still not working.
Please, can anyone help me.
thanks a lot for the help.

Have you tried this solution?
https://github.com/webdriverio/webdriverio/issues/602
Specifically, adding:
var options = {
desiredCapabilities: {
browserName: 'chrome'
},
host: 'localhost',
port: 4444
};
Worked for me.

Very long time after, but I faced this issue with Appium and I'd like to share what I find to solve it in case someone else face it with Appium.
Open Appium server application and start the server with host: 127.0.0.1 and port: 4723.
Open your Emulator or connect device.
Run again the instruction to execute it.

As per the docs:
Handling the Selenium server is out of scope of the actual WebdriverIO project.
So we need to either go with raw ChromeDriver or spin up the Selenium grid. When running with the latter and setting
WebDriver: {
url: '<your-vaue-here>',
browser: 'chrome',
host: '127.0.0.1',
port: 4444,
...
don't forget to disable the codecept.config.js section, like this:
services: [
['']
],
...
Otherwise both servers will try to use http://localhost:4444.
Caveat:
When executing codeceptJS tests in parallel via run-workers I observe flaky behaviour as some threads actually kill the Selenium grid while others are still running. To resolve this issue, disable the services section and run a dedicated Grid server as initial step in your CI pipeline (assuming this is the place you actually need the parallelism).

Related

Is there a way to include certificates in WDIO config file

Hi Am usinf webdriver Io and trying to connect to selenium grid running as HTTPS. I have included the protocol:https option. I get the following error
RequestError: unable to verify the first certificate
If I add strictSSL: false option in wdio config, I am able to connect to selenium grid.
But I do not want to use strictSSL: false and instead want to send certificates and connect the the selenium server running in https mode.
Any pointers on how to do that will be much appreciated.
Thanks

basic auth Codeceptjs with Appium

having a bit of headache getting past basic auth for our uat environments, we have switched to using Appium and I am trying to configure Codeceptjs to allow me to pass through credentials.
My current config looks like :-
exports.config = {
output: './output',
helpers: {
Appium: {
path: '/wd/hub',
port: 4723,
platform: 'Android',
browserName: 'Chrome',
url: 'https://test.co.uk/',
basicAuth: {username: 'user', password: 'pass'},
show: true,
I have looked through the Codeceptjs docs and this should pass my credentials through, does Appium work differently? All I am doin is hitting a website on a mobile, any help would be gratelly appreciated.
Forgot to mention I am testing on Android/chrome, also reults at the momemnt the username/password posted in the url obviously result site can not be reached.
Finally figured it out, seems like having special characters in the username/password, was causing the problem, now resolved.

chrome in headless mode not able to connect via webrtc

When trying to automate one of the webrtc use case via selenium in chrome-headless mode,
I configured following options:
caps := selenium.Capabilities{"browserName": "chrome"}
chromePrefs := make(map[string]interface{})
chromePrefs["profile.default_content_setting_values.media_stream_mic"] = 1
chromePrefs["profile.default_content_setting_values.media_stream_camera"] = 1
chromeCaps := chrome.Capabilities{
Path: "",
Args: []string{
"--ignore-certificate-errors",
"--use-fake-device-for-media-stream",
"--use-fake-ui-for-media-stream",
"--headless",
"--no-sandbox",
"--disable-dev-shm-usage",
},
Prefs: chromePrefs,
}
caps.AddChrome(chromeCaps)
Here I am just using golang selenium wrapper from https://github.com/tebeka/selenium which is over original java driver
So the observation is
in GUI mode(without headless) chrome is generating ice candidate for all the interfaces in my PC and
it connects well with remote peer
In Headless mode, it generates only 1 ICE candidate with type host with mdns example:392f939d-6507-45e1-87da-19b63fb76a9e.local and not anymore and ice connection is failing as remote peer I am using is in not compatible to parse mdns
To overcome I added a STUN server support with peerconnection configured to use example
var peerConnectionConfig = { 'iceServers': [{ 'url': 'stun:192.189.67.565:3478' }], 'bundlePolicy': 'max-bundle'};
And I can clearly see via wireshark, STUN Binding Request is sent and successful mapped Binding Success Response address(192.185.46.57) is sent in return, but its not used by chrome to generate additional ice candidates in this headless mode
I would like to know is there any additional/different configuration essential for chrome-webrtc-ice connections to work when using in headless mode?
Thanks
preference is not supported for headless browser
As of Feb , 2021
https://bugs.chromium.org/p/chromedriver/issues/detail?id=1925
Headless chrome doesn't support preferrences setting . You can use command line arguments only.
the full list of supported arguments are :
https://peter.sh/experiments/chromium-command-line-switches/
Here you can see --blink-settings so ,
try
chrome_options.add_arguments('--use-file-for-fake-audio-capture=random_audio.wav')
chrome_options.add_arguments('--use-file-for-fake-video-capture=random_audio.y4m')
I don't think it works, I have tried it for myself. I believe it is this issue:
https://bugs.chromium.org/p/chromium/issues/detail?id=776649
The application I am testing confirms my suspicion in the logs:
2021-02-31 17:27:19.240 Available media devices:
2021-02-31 17:27:19.241 : audioinput
2021-02-31 17:27:19.241 : videoinput
2021-02-31 17:27:19.241 : audiooutput
2021-02-31 17:27:19.256 Local media is not present NotSupportedError: Not supported
2021-02-31 17:27:19.256 No local media configured

Selenium ChromeDriver Failed to load resource: net::ERR_CONNECTION_CLOSED

I'm using Codeception to run some acceptance tests using WebDriver and a Docker Selenium standalone server. I noticed that after one of my tests threw an error I get this logged:
[Selenium browser Logs]
13:59:52.345 SEVERE - https://ssl.google-analytics.com/ga.js - Failed to load resource: net::ERR_CONNECTION_CLOSED
Funny thing is that there isn't any google analytics on the page at all (or the app for that matter). I'm guessing that there is some anonymous usage analytics but can't tell whose it is, whether it's Selenium, Codeception or it's included libs, or even the ChromeDriver for Selenium. I run the Selenium server with --net=host and maybe that has something to do with it.
Anyone know how to turn these analytics off or let Codeception ignore failed external resources?
add the following entry to your local hosts file,
127.0.0.1 www.google-analytics.com
127.0.0.1 google-analytics.com
127.0.0.1 ssl.google-analytics.com
This works for all browsers, regardless of whether they support plugins. As long as you don't run a web server on your local machine, these connections are instantly rejected and so don't take very long to fail.
You could also try 0.0.0.0 (never personally tested by me though).
0.0.0.0 www.google-analytics.com
0.0.0.0 google-analytics.com
0.0.0.0 ssl.google-analytics.com
PS: 0.0.0.0, a null route, is better. If you're running your own web server you'll start to get 404s if your route to localhost.

Proxy issue while running script

I'm trying to use Selenium Grid2 to run concurrent Watir WebDriver scripts. I have the started the hub successfully, as I can open it up in my browser and I've spawned two nodes, each of which show in the console.
I started the node by doing this:
java -jar selenium-server-standalone-2.46.0.jar -role node -hub http://localhost:4444/grid/register -browser browserName=WatirWebDriver
I then attempted to run a test script:
require 'watir-webdriver'
caps = Selenium::WebDriver::Remote::Capabilities.ie
caps.platform = :WINDOWS
caps[:name] = "WatirWebDriver"
browser = Watir::Browser.new(
:remote,
:url => "http://xxxxxxxx:5555",
:desired_capabilities => caps)
browser.goto "http://www.google.com"
*where xxxx is local IP"
This returns a 403 Proxy error.
I can run this script basic script locally just fine in which I've just created a new IE browser instance and then told it to go to google. However, I did try setting http_proxy with my company's proxy information and that didn't work either. That however gave me an access denied error when I ran the script both locally and through the node. However, I know the creds are correct.
Thanks in advance for any help you can provide.
My issue was that I needed to be pointing to /wd/hub foor the url: http://xxxxxxxx:5555/wd/hub
Once I did that, it worked. Should have done more research before posting question...