Category: Selenium

DesiredCapabilities/BrowserOptions in Selenium

headless launch option Accept and bypass privacy error disable info bar change height/width of window run code in incognito mode (private browsing) launch browser in mobile view headless launch option Let us google search “upgrade to selenium 4” Click the first search result link https://www.selenium.dev/documentation/webdriver/troubleshooting/upgrade_to_selenium_4/  Notice below that the DesiredCapabilities is now kind of deprecated. […]

Exceptions in Selenium

InvalidArgumentException UnhandledAlertException NoAlertPresentException InvalidSelectorException NoSuchElementException TimeoutException NoSuchSessionException ElementNotVisibleException StaleElementReferenceException Compound class names not permitted Element not clickable at point (yy, zz) NoSuchFrameException NoSuchWindowException InvalidArgumentExceptionInvalidArgumentException is thrown when we do not include https:// or http:// in the url. Notice below, we get InvalidArgumentException since https:// is missing in url To resolve this exception, we have to […]

Explicit wait in Selenium

1. Introduction of explicit wait in Selenium 2. Practical usage of explict wait 3. Source code Introduction of explicit wait in Selenium In the previous blog, we have studied about implicit wait, the default wait time selenium waits to find elements on web page.  Sometimes we may want to wait extra time only for a […]

Implicit waits in Selenium

1. Implicit wait usage in Selenium 2. Custom implict wait 3. Source code Implicit wait usage in Selenium The below official page describes the various Timeouts in Selenium https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/WebDriver.Timeouts.html  As seen in below description, no limit is set for default timeout in Selenium Let us go to http://uitestingplayground.com/ajax to understand the usage of timeouts in […]

Handle WebTables in Selenium Webdriver

Navigate to https://money.rediff.com/index.html Click ‘More gainers’ link that you see in below figure You get a list of all the companies, see below figure This is an example of Webtable, it is a kind of an excel file where elements are present in a systematic tabular manner. Right click & inspect this Webtable, you will […]

Identify elements using Xpath

Definition of xpath locator in Selenium webdriver  xpath syntax/example Simplified xpath syntax xpath regular expression to identify element (‘contains’ keyword) Parent-child xpath relation Difference between relative and absolute xpath Source code Definition of xpath locator in Selenium webdriverWe can identify elements using their xpath (which is simply an address of an element on the webpage). […]

Action class Mouse Hover operation in Selenium and keypress events

Perform Mouse Hover with the help of Actions class – Example 1 Example 2 of mouse hover Keypress events (Control+a) Keypress events (Control+c) TAB key Keypress events (Control+v) Source code (mouse hover) Source code (keypress)  Perform Mouse Hover with the help of Actions class – Example 1 Launch https://www.spicejet.com/  When we mouse hover ‘Add-ons’ menu, […]

Locate WebElements using LinkText and PartialLinkText methods in selenium

What you will Learn in this blog: linkText() method usage in selenium partialLinkText() method usage in selenium Source code linkText() method usage in selenium Let us now see the usage of ‘linkText()’ method in selenium. Launch https://www.bbc.com/  There are many links on the home page like News, Sport etc as can be seen below Let […]

How To setup Selenium Webdriver in Eclipse IDE

What you will Learn in this blog: Install Java runtime environment on Windows Set Java home path in System variables Go to the command prompt to check if java is set properly Install Eclipse IDE Create new Maven project in eclipse Give knowledge of ‘Selenium’ maven dependency in pom xml Give knowledge of ‘WebdriverManager’ dependency […]

Selenium WebDriver with Java Interview Questions – Part 2

Table of Contents 1. What is the difference between Assert and Verify. 2. What are Hard and Soft Asserts in selenium? 3. What is the Action Class in Selenium? 4. How can I switch to Multiple Windows in Selenium? 5. How to handle alerts pop up in Selenium? 6. Explain Javascript Executor in Selenium. 7. […]