5

So I am running a simple enough Selenium program through the GRID. I have Grid and Node all setup working perfectly.

The issue I am having is with the below :

    driver.manage().window().setPosition(new Point(X,Y));

This appears to have zero effect on the browser on the node machine. Looking at the server this command is understand and even processed without error :

14:57:02.811 INFO - Done: [set window position]

14:57:11.318 INFO - Executing: [get window position])

Code used was

    driver.manage().window().setPosition(new Point(600, 500));

I inserted some code to get the cords of the browser, and they are returned as :

    System.out.println(" POSITION " +driver.manage().window().getPosition());

RESULT = "POSITION (600, 500)"

I am using the "import org.openqa.selenium.Point;" import.

There are not other issues with the code.

The reason I need to move the browser , is because a second browser keeps overlapping the first browser , thus making it impossible for Selenium to interact with the first browser (I am using the parallel testing . I resized both browsers to try and fix the issue. Incidentally, there is no issue at all with the resize code (below) that works perfectly :

    driver.manage().window().setSize(new Dimension(600, 500));

FULL CODE :

        DesiredCapabilities cap = DesiredCapabilities.firefox();
        cap.setBrowserName("firefox");
        driver = new RemoteWebDriver(new URL(Node), cap);
        // Puts an Implicit wait, Will wait for 10 seconds before throwing
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
        // Launch website
        driver.navigate().to(URL);
        driver.manage().window().setSize(new Dimension(600, 500));
        driver.manage().window().setPosition(new Point(600, 500));
Daragh
  • 123
  • 3
  • 13
  • I used to run parallel tests and I had no problems with overlapping browsers - how do you know that the problem comes from the overlapping ? – Tim Mar 29 '17 at 14:33
  • Because when I set onto debug and manually move the window out of the way , then resume, all works well. Even at that , it would be good to check the test are running in parallel – Daragh Mar 29 '17 at 14:35
  • @TIM , Sorry, I should point out, I am using two instances of firefox , rather than separate browsers. I have testNg to run the tests as parallel. Running the same code , with different browsers yield no issues (e.g Chrom & firefox , but not Firefox & firefox – Daragh Mar 29 '17 at 14:39
  • I am afraid I cannot really help you then. You could try launching the browsers in incognito mode and see if you still get the problem. – Tim Mar 30 '17 at 11:12

0 Answers0