What are some of the common exceptions one could face in Selenium

0 votes
What are some of the common exceptions one could face in Selenium?
May 22, 2019 in Selenium by Monisha
1,637 views

1 answer to this question.

0 votes

Hey Monisha, some of the common Selenium Exceptions are as follows:

  1. WebDriverException: WebDriver Exception comes when we try to perform any action on the non-existing driver.
    • WebDriver driver = new InternetExplorerDriver();
      driver.get("http://google.com");
      driver.close();
      driver.quit();
  2. NoAlertPresentException: When we try to perform an action i.e., either accept() or dismiss() which is not required at a required place; gives us this exception.
    • try{
      driver.switchTo().alert().accept();
      }
      catch (NoAlertPresentException E){
      E.printStackTrace();
      }
  3. NoSuchWindowException: When we try to switch to a window which is not present gives us this exception:
    • WebDriver driver = new InternetExplorerDriver();
      driver.get("http://google.com");
      driver.switchTo().window("Yup_Fail");
      driver.close();
  4. NoSuchFrameException: Similar to Window exception, Frame exception mainly comes during switching between the frames.
    • WebDriver driver = new InternetExplorerDriver();
      driver.get("http://google.com");
      driver.switchTo().frame("F_fail");
      driver.close();
  5. NoSuchElementException: This exception is thrown when we WebDriver doesn’t find the web-element in the DOM.
    • WebDriver driver = new InternetExplorerDriver();
      driver.get("http://google.com");
      driver.findElement(By.name("fake")).click();
answered May 23, 2019 by Satyam

Related Questions In Selenium

0 votes
1 answer

What are some of the browser commands used in Selenium Webdriver?

Hi Nakul, some of the most frequently ...READ MORE

answered May 14, 2019 in Selenium by Abha
• 28,140 points
805 views
0 votes
1 answer

What are the types of Assertion in Selenium?

In selenium Assertion is nothing but a ...READ MORE

answered Feb 11, 2019 in Selenium by Fred
2,226 views
0 votes
1 answer

What are the major exceptions that occur in Selenium?

There are mostly 5 different types of ...READ MORE

answered Feb 13, 2019 in Selenium by Priyaj
• 58,020 points
664 views
0 votes
1 answer

What are locators in Selenium and what are the different types of it?

Hi Divya, in Selenium Locators define an ...READ MORE

answered May 7, 2019 in Selenium by Abha
• 28,140 points
2,662 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,674 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,143 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,875 views
0 votes
2 answers

What are the limitations of Selenium?

Hi Moray, limitations of selenium webdriver are ...READ MORE

answered Jun 10, 2019 in Selenium by Abha
• 28,140 points
8,122 views
0 votes
1 answer

What are the phases of Selenium Life Cycle?

Selenium life cycle has following 5 phases: Test ...READ MORE

answered May 10, 2019 in Selenium by Prashant
5,243 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP