Selenium Python Exception Handling | Selenium Python Tutorial

Поділитися
Вставка
  • Опубліковано 10 гру 2024

КОМЕНТАРІ • 12

  • @adityarastogi3483
    @adityarastogi3483 2 роки тому

    A big big big thanks to you !! you made it really easy ..thanks a lot !

  • @rafaeljesus7596
    @rafaeljesus7596 3 роки тому

    when I type "NoSuchElementException" it simply doesn't find it, it simply does not recognize it as an exception because "except" only recognizes standard python exceptions and not selenium exceptions, any insights?

    • @sdetunicorns
      @sdetunicorns  3 роки тому

      Hi Rafael, you need to import errors from the selenium library first and then use it in your test so that it can recognize it

    • @rafaeljesus7596
      @rafaeljesus7596 3 роки тому

      @@sdetunicorns oh.. ok, will try that

    • @rafaeljesus7596
      @rafaeljesus7596 3 роки тому

      @@sdetunicorns I tried importing the entire selenium driver, when I type "except " it doesn't find it, it keeps suggesting the same standard python errors. How do I import selenium errors correctly? I am using chrome webdriver, python 3.9.7.

    • @sdetunicorns
      @sdetunicorns  3 роки тому +1

      You can compare your code with mine and see if it works - github.com/automationbro/seleniumbase-tests/blob/master/tests/test_shop.py

    • @rafaeljesus7596
      @rafaeljesus7596 3 роки тому +1

      @@sdetunicorns thanks, it worked now, I just had to import exceptions from "selenium.common.exceptions", it seems that simply importing the entire library won't work

  • @shivanandhiremath8217
    @shivanandhiremath8217 Рік тому

    do you have the git link of all this code

    • @sdetunicorns
      @sdetunicorns  Рік тому

      github.com/dilpreetj/selenide-youtube-series

  • @k.m.jiaulislamjibon1443
    @k.m.jiaulislamjibon1443 3 роки тому +1

    Everyone showing just simple exception handling but not anyone showed production based and pythonic way to handle exceptions and log those .... 🥺

    • @sdetunicorns
      @sdetunicorns  3 роки тому

      "production based" is no different, at the end you are handling the exceptions same way. You would probably have more abstraction to handle code more elegantly but other than that the basics remain the same.