Selenium WebDriver verify the object (chat window) is displayed at the bottom left hand corner of the browser

Can Selenium WebDriver verify the object (eg. small chat window) is displayed at the bottom left hand corner of the browser?

I know how to verity object is exist on the page with using, but not the location on the browser


Boolean isChatWindowExists = driver.findElements(By.id("chatWindowID")).size()!=0;

if(isChatWindowExists == true){

System.out.println("Passed. Chat window is displayed at the bottom left hand corner of the browser");

}else{

System.out.println("Failed. Chat window is not displayed at the bottom left hand corner of the browser");

}

Any idea how to perform verify action in Selenium WebDriver Java.  Also, it will be testing at different workstation with different resolution. Thanks

Add Comment
1 Answer(s)

You can always get the element location using the getLocation() method on WebElement. Just check for point to be some where near the bottom right of the screen coordinates.

Do let me know if you need more information.

Thanks
Virender

Virender Singh Professor Answered on May 12, 2015.

Hi Virender Singh,

After get point (x,y) (eg Coordinate x is 1700, Coordinate y is 829), what should I do with it? How can I use this info, point x, y to check that the chat window is located at the bottom left hand corner of the browser? Thanks.

ps: the chat window is sort like separate pop up window

on May 12, 2015.

You can get the complete screen size using exiting Java APIs and compare this point to be near the bottom left of the screen.

http://docs.oracle.com/javase/6/docs/api/java/awt/Toolkit.html#getScreenSize%28%29

This is the API Documentation of the getScreen coordinates method

Virender

on May 13, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.