java - action.keyDown(Keys.CONTROL).sendKeys("j").keyUp(Keys.CONTROL).build().perform(); does not work if the test browser is not under focus of the OS -


i using java , selenium write tests chrome. need open download page @ 1 point used code below:

action.keydown(keys.control).sendkeys("j").keyup(keys.control).build().perform(); 

and works long os focus on test browser, mean if run test , go , click somewhere else (for example if start coding in ide while test running) code wont work.

how can bring focus test browser or other way code works , download window open on test browser?

the interesting point works for: action.keydown(keys.control).sendkeys("a").keyup(keys.control).build().perform(); if it's not focused!!!

if goal clear downloads, , cannot start chromedriver fresh state, can try following:

    driver.get("chrome://downloads/");     ((javascriptexecutor) driver).executescript("chrome.send('clearall');"); 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -