Selenium ChromeDriver Cannot assign requested values - selenium

The chromedriver for selenium has recently stopped being able to bind. I am able to launch the hub and the chromedriver, but once I start running the tests, there are errors shown below. Does anyone know if the recent ChromeDriver upgrade has changed something? (Am using the 3.141 version of selenium)
15:28:46.684 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 78.0.3904.70 (...-refs/branch-heads/3904#{#800}) on port XXXX
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1572622126.697][SEVERE]: bind() failed: Cannot assign requested address (99)
15:28:49.324 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
15:28:49.329 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 2ff751ceeb9c34c517e24c43a983a3cb (org.openqa.selenium.chrome.ChromeDriverService)
And the driver options configuration:
public WebDriver getDriver() {
AppContext.getEnv().setDriverPermissions(this);
new DesiredCapabilities();
ChromeOptions ops = new ChromeOptions();
ops.addArguments("--incognito");
ops.addArguments("--window-size=1920,1080");
ops.addArguments("--disable-notifications");
ops.addArguments("--allow-running-insecure-content");
ops.addArguments("--start-maximized");
ops.addArguments("--whitelisted-ips");
//ops.addArguments("--headless");
System.setProperty("webdriver.chrome.driver", AppContext.getEnv().getDriverPath(this));
return new ChromeDriver(ops);

Related

Geckodriver with webdriverIo giving session already started error

I am trying to run automation on firefox browser. I am passing the following set of options:
const firefoxOptions = {
capabilities: {
browserName: "firefox"
},
services: [
"geckodriver"
]
}
I also have geckdriver running a separate terminal tab, which is giving out the following logs on execution:
mahimakh#88665a46834a Downloads % ./geckodriver --port=4444
1667519366314 geckodriver INFO Listening on 127.0.0.1:4444
1667519377223 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "--marionette" "-foreground" "-no-remote" "-profile" "/var/folders/gv/yctv5ytx7yd7xbhcw5qz4v_40000gs/T/rust_mozprofilecZIetT"
2022-11-03 16:49:37.780 plugin-container[26937:1559502] nil host used in call to allowsSpecificHTTPSCertificateForHost
2022-11-03 16:49:37.781 plugin-container[26937:1559502] nil host used in call to allowsAnyHTTPSCertificateForHost:
2022-11-03 16:49:37.785 plugin-container[26937:1559502] nil host used in call to allowsSpecificHTTPSCertificateForHost
2022-11-03 16:49:37.785 plugin-container[26937:1559502] nil host used in call to allowsAnyHTTPSCertificateForHost:
2022-11-03 16:49:37.785 plugin-container[26937:1559507] nil host used in call to allowsSpecificHTTPSCertificateForHost
2022-11-03 16:49:37.785 plugin-container[26937:1559507] nil host used in call to allowsAnyHTTPSCertificateForHost:
1667519377786 Marionette INFO Marionette enabled
1667519377819 Marionette INFO Listening on port 51739
Read port: 51739
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at /var/folders/gv/yctv5ytx7yd7xbhcw5qz4v_40000gs/T/rust_mozprofilecZIetT/search.json.mozlz4", (void 0)))
2022-11-03 23:49:44.448 plugin-container[26991:1560037] nil host used in call to allowsSpecificHTTPSCertificateForHost
2022-11-03 23:49:44.448 plugin-container[26991:1560037] nil host used in call to allowsAnyHTTPSCertificateForHost:
2022-11-03 23:49:44.472 plugin-container[26991:1560037] nil host used in call to allowsSpecificHTTPSCertificateForHost
2022-11-03 23:49:44.472 plugin-container[26991:1560037] nil host used in call to allowsAnyHTTPSCertificateForHost:
2022-11-03 23:49:44.473 plugin-container[26991:1560041] nil host used in call to allowsSpecificHTTPSCertificateForHost
2022-11-03 23:49:44.473 plugin-container[26991:1560041] nil host used in call to allowsAnyHTTPSCertificateForHost:
I have a selenium standalone server running on my local too:
16:55:35.665 INFO - Selenium build info: version: '3.5.3', revision: 'a88d25fe6b'
16:55:35.666 INFO - Launching a standalone Selenium Server
2022-11-03 16:55:35.695:INFO::main: Logging initialized #351ms to org.seleniumhq.jetty9.util.log.StdErrLog
16:55:35.756 INFO - Driver class not found: com.opera.core.systems.OperaDriver
16:55:35.797 INFO - Driver provider class org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC
16:55:35.797 INFO - Driver provider class org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC
16:55:35.829 INFO - Using the passthrough mode handler
2022-11-03 16:55:35.855:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2022-11-03 16:55:35.878:WARN:osjs.SecurityHandler:main: ServletContext#o.s.j.s.ServletContextHandler#6f1fba17{/,null,STARTING} has uncovered http methods for path: /
2022-11-03 16:55:35.882:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler#6f1fba17{/,null,AVAILABLE}
2022-11-03 16:55:35.908:INFO:osjs.AbstractConnector:main: Started ServerConnector#5e853265{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2022-11-03 16:55:35.909:INFO:osjs.Server:main: Started #564ms
16:55:35.909 INFO - Selenium Server is up and running
On starting the execution, even though firefox opens and performs a set of tasks, but initially it gives the following error:
2022-11-03T23:49:41.942Z INFO webdriver: COMMAND status()
2022-11-03T23:49:41.943Z INFO webdriver: [GET] http://localhost:4444/status
2022-11-03T23:49:41.945Z INFO webdriver: RESULT { message: 'Session already started', ready: false }
ERROR: checkStatus failed, Session Status Missing "build" Object!
1) Validate Retail Website Title
And later it fails with webdriver being null exception! Can anyone help me understand what i am doing wrong here?

Selenium Server and Chromedriver doesn't work on Linux

I have a Selenium Standalone Server on my local machine (MAC), and it works fine every time I run a test (WebdriverIO).
09:27:06.951 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "chrome",
"goog:chromeOptions": {
"args": [
"--headless",
"--disable-gpu",
"--window-size=1024,768",
"--no-sandbox"
]
}
}
09:27:06.962 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.42.591059 (a3d9684d10d61aa0c45f6723b327283be1ebaad8) on port 42652
Only local connections are allowed.
09:27:08.168 INFO [ProtocolHandshake.createSession] - Detected dialect: OSS
09:27:08.314 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 3a6c1206b6cd99a762007069868cad2f (org.openqa.selenium.chrome.ChromeDriverService)
09:27:19.053 INFO [ActiveSessions$1.onStop] - Removing session 3a6c1206b6cd99a762007069868cad2f (org.openqa.selenium.chrome.ChromeDriverService)
Now, I am trying to move the selenium server to a Linux machine. I configured and installed all the necessary packages. However, the test just hanged.
Selenium log from Linux machine
[dnguyen#test tmp]$ java -jar selenium-server-standalone-3.141.59.jar
09:24:02.305 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
09:24:02.373 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2019-05-03 09:24:02.413:INFO::main: Logging initialized #289ms to org.seleniumhq.jetty9.util.log.StdErrLog
09:24:02.604 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
09:24:02.697 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
09:24:16.387 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "chrome",
"goog:chromeOptions": {
"args": [
"--headless",
"--disable-gpu",
"--window-size=1024,768",
"--no-sandbox"
]
}
}
09:24:16.388 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 72.0.3626.7 (efcef9a3ecda02b2132af215116a03852d08b9cb) on port 29488
Only local connections are allowed.
[1556889856.409][SEVERE]: CreatePlatformSocket() returned an error, errno=0: Address family not supported by protocol (97)
[1556889856.714][SEVERE]: CreatePlatformSocket() returned an error, errno=0: Address family not supported by protocol (97)
09:24:16.791 INFO [ProtocolHandshake.createSession] - Detected dialect: OSS
09:24:17.078 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 86ea9b4bd11c3d2d8a994e893440087e (org.openqa.selenium.chrome.ChromeDriverService)
Log from WebdriverIO
Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/path-to-test.js)
It doesn't have that error when I run on my local machine. Not sure what is the different between Selenium Server on MAC and Linux.
Updated: The 443 port on the Linux server doesn't open, so it cannot reach the site. That's all.
The 443 port on the Linux server doesn't open, so it cannot reach the site. That's all.
If you are in the same situation, you can try to use WGET to reach the site first.

WebDriverException: Error forwarding the new session Error forwarding the request Connect to my_ip:5555 [/my_ip] failed: Connection timed out

I installed selenium node on AWS windows and started it. And I setup Jenkins, git, Seleniuim hub on AWS Linux. When i'm building app on Jenkins, selenium hub is trying to connect to selenium node of AWS windows with private IP address. And i'm getting following exception:
org.openqa.selenium.WebDriverException:
Error forwarding the new session Error forwarding the request Connect to windows_private_ip:5555 [/windows_private_ip] failed: Connection timed out (Connection timed out)
Command duration or timeout: 190.25 seconds
Build info: version: '3.5.1', revision: '9c21bb67ef', time: '2017-08-17T15:26:08.955Z'
System info: host: 'some_host_name', ip: 'some_ip', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.76-3.78.amzn1.x86_64', java.version: '1.8.0_151'
Driver info: driver.version: RemoteWebDriver
Caused by: org.openqa.grid.common.exception.GridException: Error forwarding the new session Error forwarding the request Connect to windows_private_ip:5555 [/windows_private_ip] failed: Connection timed out (Connection timed out)
Grid Node command:
C:\Users\Administrator>java -Dwebdriver.chrome.driver=./drivers/windows-driver/chromedriver.exe -jar C:\\Users\\Administrator\\Desktop\\selenium-server-standalone-3.0.1.jar -role node -hub http://ip_address:4444/grid/register
My code is:
if (browser.equalsIgnoreCase("FF")) {
System.setProperty("webdriver.gecko.driver", "drivers/windows-driver/geckodriver.exe");
DesiredCapabilities cap = DesiredCapabilities.firefox();
// Set the platform where we want to run our test- we can use
// MAC and Linux and other platforms as well
cap.setPlatform(Platform.ANY);
cap.setCapability("gecko", true);
// Here you can use hub address, hub will take the
// responsibility to execute the test on respective node
URL url = new URL("http://hub_public_ip:4444/wd/hub");
// Create driver with hub address and capability
gbb = PageFactory.initElements(new RemoteWebDriver(url, cap), GuruBase.class);
} else if (browser.equalsIgnoreCase("IE")) {
System.setProperty("webdriver.ie.driver", "drivers/windows-driver/IEDriverServer.exe");
gbb = PageFactory.initElements(new InternetExplorerDriver(), GuruBase.class);
} else if (browser.equalsIgnoreCase("GC")) {
System.setProperty("webdriver.chrome.driver", "drivers/windows-driver/chromedriver.exe");
ChromeOptions cho = new ChromeOptions();
cho.addArguments("disabled-extensions");
cho.addArguments("--start-maximized");
gbb = PageFactory.initElements(new ChromeDriver(cho), GuruBase.class);
}
else if (browser.equalsIgnoreCase("html")) {
gbb = PageFactory.initElements(new HtmlUnitDriver(true), GuruBase.class);
}
I'm running selenium hub on Jenkins.
A quick solution will be to change :
java -Dwebdriver.gecko.driver=./drivers/windows-driver/chromedriver.exe -jar C:\\Users\\Administrator\\Desktop\\selenium-server-standalone-3.0.1.jar -role node -hub http://ip_address:4444/grid/register
As you are using Dwebdriver.gecko.driver with chromedriver.exe
To either :
Use GeckoDriver :
java -Dwebdriver.gecko.driver=./drivers/windows-driver/geckodriver.exe -jar C:\\Users\\Administrator\\Desktop\\selenium-server-standalone-3.0.1.jar -role node -hub http://ip_address:4444/grid/register
Use Chromedriver :
java -Dwebdriver.chrome.driver=./drivers/windows-driver/chromedriver.exe -jar C:\\Users\\Administrator\\Desktop\\selenium-server-standalone-3.0.1.jar -role node -hub http://ip_address:4444/grid/register
Additionally, you need to check your if() loop as you have a mixed up representation of Windows and Linux styles in System.setProperty() line as follows :
GeckoDriver :
System.setProperty("webdriver.gecko.driver", "drivers/windows-driver/geckodriver.exe");
ChromeDriver :
System.setProperty("webdriver.chrome.driver", "drivers/windows-driver/chromedriver");
IEDriverServer :
System.setProperty("webdriver.ie.driver", "drivers/windows-driver/IEDriverServer.exe");
Note : On Windows Systems you need to mention the extension .exe part e.g. geckodriver.exe while on Linux Systems you need strip off the extension .exe part e.g. chromedriver
This probably caused by your ip not matched. I met the same error and I found that there are two IPv4 address for my machine. One is Eather net and another is WLAN.
Steps:
Disconnect the Wi-Fi.
Use command : ipconfig to check my IPv4 address (there's only one IP there).
With one IP only it should create session correctly.
Perhaps you are using your office computer to make transaction between your node and your hub.
to some extent, you can push your code from office computer <=> github <=> AWS EC2 console.
but registering it as a node / hub and trying to execute the test case may not be possible.
please try with a server in same environment.

Run selenium server using SSL

Please note that my question is not about testing ssl/tls secured http links and not about making Webdriver accept certain certificates.
My question is about how to make the embedded Jetty of selenium standalone server provide a secured https connection.
In the sourcecode of 3.4.0 I can see this section:
HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.setSecureScheme("https");
httpConfig.setSecurePort(config.port);
log.info("Will listen on " + config.port);
ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(httpConfig));
http.setPort(config.port);
server.addConnector(http);
From the logs I can see that this code is reached but the connection is not secured (how should it be, there isn't even a certificate involved):
10:57:00.023 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
10:57:00.024 INFO - Launching Selenium Grid hub
2017-05-09 10:57:01.707:INFO::main: Logging initialized #2044ms to org.seleniumhq.jetty9.util.log.StdErrLog
10:57:01.721 INFO - Will listen on 4444
2017-05-09 10:57:01.800:INFO:osjs.Server:main: jetty-9.4.3.v20170317
2017-05-09 10:57:01.851:INFO:osjs.session:main: DefaultSessionIdManager workerName=node0
Because of company security governance we are forced to provide all services secured. This means I need to secure at least the hub of selenium grid, nodes would be perfect too. I know that I could do some tunneling, proxying or ipsec but I want to avoid this complexity if possible.
I even tried if Jetty somehow "automagically" knows to respond accordingly if ssl is used but as expected this fails:

Codeception: Webdriver could not be found and loaded

I am having some issues running Codeception with Selenium on Windows 8 at my new job.
I get this error:
[Codeception\Exception\Configuration]
Webdriver could not be found and loaded.
I started the Selenium server manually like I described last time in this post: Web Driver Curl Exception
Anyone have any ideas how to fix this?
Edit - Some more info:
I am running WAMP server.
I have configured a Virtual Host in httpd-vhostsconf
I have verified that the Selenium server is started. I tried to run the codeception test with and without the server started, in both cases I get the exact same message.
This is the content of acceptance.suite.yml:
modules:
enabled:
- Webdriver
- AcceptanceHelper
config:
PhpBrowser:
url: 'http://www.mywebsite.dev/'
Webdriver:
url: 'http://www.mywebsite.dev/'
browser: firefox
So look like the problem is mistake in the module name, it should be WebDriver instead of Webdriver
Try running with:
modules:
enabled:
- WebDriver
- AcceptanceHelper
config:
PhpBrowser:
url: 'http://www.mywebsite.dev/'
WebDriver:
url: 'http://www.mywebsite.dev/'
browser: firefox
It should work.