0

I am running a test to test pages in the responsive design view in Firefox. Expectation is, that the page should display/shouldn't display a few elements based on the size of the screen.

To verify that, I'd like to change resolutions dynamically to validate presence or absence of elements and leave the responsive design view once I am done with my assertions.

I understand that resolutions can be changed by updating the desired capabilities or even with firefox profiles. Just wondering if it's possible to access elements in the row highlighted in the screenshot? I don't think find element would work as these icons are outside the html. Are there other options ?

public class Test {

    public static void main(String[] args) {

        WebDriver driver = new FirefoxDriver();
        driver.get("https://www.google.com");
        Actions action1 =  new Actions(driver);
        action1.keyDown(Keys.COMMAND);
        action1.keyDown(Keys.ALT);
        action1.sendKeys("m");
        action1.keyUp(Keys.COMMAND);
        action1.keyUp(Keys.ALT);
        action1.perform();
        driver.quit();
    }
}

Environment: OS - Mac Selenium version - 2.48.2 Firefox version - 41

enter image description here

Karthick R
  • 599
  • 9
  • 25
  • 1
    Might this help you? http://stackoverflow.com/questions/18596732/specifying-custom-screen-resolution-in-selenium-tests. driver.manage().window().setSize(new Dimension(1024, 768)) – Viv Sep 29 '16 at 20:38
  • I read that post. It does solve a part of my problem but I'd like to know if there is a way to access the part of the screen highlighted in the screenshot. I've updated the question. – Karthick R Sep 29 '16 at 20:41
  • 1
    Can you setSize(x,y) repeatedly during the execution of your programme? – Viv Sep 29 '16 at 20:49

1 Answers1

0

We get this by combining SikuliX with Selenium API, in the same script.

We have the best of both worlds:

  • On one hand, SikuliX can be used to automate any web or desktop app. You locate and manipulate the buttons and different GUI elements of Firefox, by image recognition.
  • On the other hand, Selenium is good processing DOM.
david.perez
  • 6,090
  • 4
  • 34
  • 57