There is a test written in Java
, which I execute from IntelliJ IDEA
and opens a Firefox
. It uses some files from local machine to upload those and then receive too some files.
In this case browser window needs permanent focus, otherwise it is not working, can't select the necessary files. I would like to use machine during test is running, because test is long-running.
How could I execute it without browser focus?
Asked
Active
Viewed 513 times
1

plaidshirt
- 5,189
- 19
- 91
- 181
-
1Consider using the Headless browsers HtmlUnit, PhantomJS or Headless Chrome – undetected Selenium Aug 16 '17 at 08:33
-
I use Java/Selenium tests all the time and they don't need focus. I'm not sure why yours would. – JeffC Aug 16 '17 at 17:32
-
@Jeffc : It needs focus, otherwise it will not put the link to the file chooser window. – plaidshirt Aug 17 '17 at 18:29
-
It sounds like you aren't doing it correctly. See this answer: https://stackoverflow.com/a/16908970/2386774 – JeffC Aug 17 '17 at 19:24
-
@JeffC : Type is : , so this example doesn't fit. – plaidshirt Aug 18 '17 at 07:39
2 Answers
1
I think I understand what you are trying to achieve.
Try to use non GUI browsers like PhantomJS or HtmlUnit
http://htmlunit.sourceforge.net/ and How to implement PhantomJS with Selenium WebDriver using java

implssv
- 72
- 10
1
You have to use HtmlUnitDriver or PhantomJS to Execute WebDriver based tests without browser focus.
WebDriver driver = new HtmlUnitDriver();
driver.get("http://www.google.com");

iamsankalp89
- 4,607
- 2
- 15
- 36
-
What else should I change on project, to be executed in these browsers? – plaidshirt Aug 16 '17 at 09:17
-
-