We might have noticed that - when a page is opened a pop up banner gets displayed and when press "escape" button on keyboard, then this pop up/Alert box OR Banner gets closed.
How to achieve this through Selenium
Ans: we have to use css selector to locate the body text of HTML and then we need to press ESCAPE button
Note: CSS selector is alone selector which can access entire body of HTML
Sample Code:
driver.findElement(by.xpath(" ")).sendKeys(Keys.ESCAPE);
Post a Comment