InvalidArgument Exception

3,862 views
Skip to first unread message

Radhika Joshi

unread,
Mar 23, 2020, 5:59:23 AM3/23/20
to seleniu...@googlegroups.com
Hi all,
I am getting an invalid argument exception when the chrome browser opens. Following is my code. Also I have attached screenshots of the exception :
package FirstNaukri;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class OpenAndCloseBrowser {

public static void main(String args[]) {
System.setProperty("webdriver.chrome.driver","E://chromedriver.exe");
WebDriver driver= new ChromeDriver();
String BaseUrl= "assessments.firstnaukri.com/TE/022616537";
driver.get(BaseUrl);
driver.close();


}

}

Exception in thread "main" org.openqa.selenium.InvalidArgumentException: invalid argument
  (Session info: chrome=80.0.3987.149)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'LAPTOP-ITOBSG23', ip: '192.168.225.210', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '14'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 80.0.3987.149, chrome: {chromedriverVersion: 80.0.3987.106 (f68069574609..., userDataDir: C:\Users\RADHIK~1\AppData\L...}, goog:chromeOptions: {debuggerAddress: localhost:54287}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 0e62445a55c0657b8426da1a1fea5efb
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:277)
at FirstNaukri.OpenAndCloseBrowser.main(OpenAndCloseBrowser.java:12)
chrome driver unable to open.png
Illegal argument exception.png

mahesh harish

unread,
Mar 23, 2020, 6:18:54 AM3/23/20
to seleniu...@googlegroups.com
Hi ,

For url pass the http or https initial . can you check and let me know

Thanks 
Mahesh G 



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CALLrrpJgcDcMG80ya5JmrsBxAK--B_KTzJeTvuyV5oZ4dfvsyA%40mail.gmail.com.

Radhika Joshi

unread,
Mar 23, 2020, 6:21:40 AM3/23/20
to seleniu...@googlegroups.com
It works for me . Thankyou for your help !
Have a great day!!!

Thanks and Regards
Radhika Joshi


mahesh harish

unread,
Mar 23, 2020, 6:23:27 AM3/23/20
to seleniu...@googlegroups.com
http://assessments.firstnaukri.com/TE/022616537

Try like this definitely I Will be work



On Mon, Mar 23, 2020, 3:28 PM Radhika Joshi <radhi...@gmail.com> wrote:
--

Vemula Suresh

unread,
Mar 23, 2020, 8:10:51 AM3/23/20
to seleniu...@googlegroups.com
Please use proper  URL format like https://www.google.com,  otherwise, it will throw in valid argument exception at driver.get(url)

--

kapeesh gupta

unread,
Apr 15, 2020, 2:18:12 AM4/15/20
to Selenium Users
Hi,

I am getting the same error but not resolve as per your given solution. I am reading the data from the properties file. I am attaching my code screenshots. Please review my code and please let me know where I am doing wrong.


config.properties:
name= Tom Berry
age= 29
URL="https://www.google.com/" or "http://www.google.com/"    (both are used)
browser= chrome 

Java code

package SeleniumFirst;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class ReadProperties {
static WebDriver driver;

public static void main(String[] args) throws IOException {

Properties prop= new Properties();
FileInputStream file= new FileInputStream("D:/Selenium-Apr-20/SeleniumSession/src/SeleniumFirst/config.properties");
prop.load(file);

System.out.println(prop.getProperty("name"));

System.out.println(prop.getProperty("age"));

String url= prop.getProperty("URL");
System.out.println(url);

String browserName= prop.getProperty("browser");
System.out.println(browserName);
System.setProperty("webdriver.chrome.driver", "D://Backup/AA-DesktopFiles/Testing_Tutorial/****************/Drivers/chromedriver/chromedriver.exe");
driver = new ChromeDriver();
if(browserName.equals("chrome")){
System.setProperty("webdriver.chrome.driver","D:/Backup/AA-DesktopFiles/Testing_Tutorial/**************/Drivers/chromedriver/chromedriver.exe");
driver= new ChromeDriver(); //Launch Driver
}
else if(browserName.equals("FF")){
System.setProperty("webdriver.gecko.driver","D:/Backup/AA-DesktopFiles/Testing_Tutorial/Naveen-AutomationLabs/Drivers/geckodriver/geckodriver.exe");
driver= new FirefoxDriver(); //Launch Driver
}
driver.get(url);
}
}



Getting Error:

Tom Berry
29
chrome
Starting ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987@{#882}) on port 43226
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1586919865.197][WARNING]: This version of ChromeDriver has not been tested with Chrome version 81.
Apr 15, 2020 8:34:26 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Starting ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987@{#882}) on port 19044
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1586919869.006][WARNING]: This version of ChromeDriver has not been tested with Chrome version 81.
Apr 15, 2020 8:34:30 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Exception in thread "main" org.openqa.selenium.InvalidArgumentException: invalid argument
  (Session info: chrome=81.0.4044.92)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'ADMIN-PC', ip: '192.168.43.226', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_191'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 81.0.4044.92, chrome: {chromedriverVersion: 80.0.3987.106 (f68069574609..., userDataDir: C:\Users\Admin\AppData\Loca...}, goog:chromeOptions: {debuggerAddress: localhost:2358}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 5ba76d42fc451d698d1f89df8d5b9af7
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:277)
at SeleniumFirst.ReadProperties.main(ReadProperties.java:40)
 

⇜Krishnan Mahadevan⇝

unread,
Apr 15, 2020, 2:29:09 AM4/15/20
to Selenium Users
Get rid of the double quotes for the URL value and try again. Selenium is complaining that the URL is invalid.

Notice how the exception is stemming from the get() call

at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:277)

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.

kapeesh gupta

unread,
Apr 15, 2020, 5:02:20 AM4/15/20
to seleniu...@googlegroups.com
Hi Krishnan.

It's working now.

Thanks a lot.!

Regards,
Kapeesh Gupta


kapeesh gupta

unread,
Apr 15, 2020, 7:58:41 AM4/15/20
to Selenium Users
Hi,

I am trying to read properties file, it is working fine but I am getting error when I select the value from the drop down list. Error is given below: 
I am trying to automate the registration page of naukri.com.

Exception in thread "main" org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "input" 

Please let me know where I am wrong?

Thanks in Advance.
Reply all
Reply to author
Forward
0 new messages