Thursday, 8 May 2014

Selenium WebDriver – Open a link in a new Window


We can use Action class to open a link in a new window.

Method and Description:


  • contextClick(WebElement onElement) - Performs a context-click at middle of the given element.
  • perform()- A convenience method for performing the actions without calling build() first.
  • sendKeys(java.lang.CharSequence... keysToSend) - Sends keys to the active element.

 

Example:

Below example opens w3schools.com
And click on “Learn HTML” link to open in new window.

No comments:

Post a Comment