Getting exception "[1561285646.738][WARNING]: Timed out connecting to Chrome, retrying... org.openqa.selenium.InvalidArgumentException: invalid argument"

2,461 views
Skip to first unread message

suhali rattan

unread,
Jun 23, 2019, 6:41:02 AM6/23/19
to seleniu...@googlegroups.com
Getting exception "[1561285646.738][WARNING]: Timed out connecting to Chrome, retrying...
org.openqa.selenium.InvalidArgumentException: invalid argument" 

CODE
public class AlertHandling {
WebDriver driver;
String url = "https://www.w3schools.com/js/tryit.asp?filename=tryjs_alert";  
public void invokeBrowser() {
try {
System.setProperty("webdriver.chrome.driver",
"D:\\Selenium Practice\\Suhali\\chromedriver_win32\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().deleteAllCookies();
driver.manage().window().maximize();
driver.manage().timeouts().pageLoadTimeout(5, TimeUnit.SECONDS);
driver.get("url");
driver.switchTo().frame("iframeResult");
driver.findElement(By.tagName("button")).click();
Alert alert = driver.switchTo().alert();
String alertmsg = alert.getText();
System.out.println("alert msg:" + alertmsg);
alert.accept();
driver.quit();
} catch (Exception e) {
// TODO Auto-generated catch block

e.printStackTrace();
}}
public static void main(String[] args) {

AlertHandling ah = new AlertHandling();
ah.invokeBrowser();
}}
Using chromedriver version :75.0.3770.90
Google chrome version:  75.0.3770.100
O.S : Windows 10

Regards,
Suhali Rattan

Joe Ward

unread,
Jun 23, 2019, 9:38:59 AM6/23/19
to seleniu...@googlegroups.com
I can't remember the specifics as to why, but the issue is probably with driver.manage().window().maximize();. I'd recommend something like removing that line, trying driver.manage().window().fullscreen();, or setting it up with the --start-maximized argument. Also, driver.get("url"); should be driver.get(url);. There are some other issues but that's as far as I can get you in the spare time I have. 

Generally, if you're new I'd recommend writing a line of code, running it, then writing more, then running it, until you have a good grasp of what's going on. Writing a heap of code and working backwards about why it's not working isn't the best idea.

--
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 post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAA4AzaFQmcY6Y%3DqTc8hsLCku%2B4jTw_ZkKEYXz6i%2BmNkkVexMCA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages