How to simulate the selenium exceptions?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to simulate the selenium exceptions?

Summer Zhang
Hi,
I want to catch the selenium exception org.openqa.selenium.SessionNotCreatedException, and now I want my case to throw this exception, then I can catch it, but I don't know how to simulate such a selenium exception in my case, anyone knows?
Thanks!

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/73c94412-197a-4d2d-a8f5-81d134cbd829%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to simulate the selenium exceptions?

Joe Ward
Why would you throw an exception immediately to catch it? Why would you need to know exactly how to simulate an exception if you could just throw it programmatically? 

On 19 June 2018 at 08:38, Summer Zhang <[hidden email]> wrote:
Hi,
I want to catch the selenium exception org.openqa.selenium.SessionNotCreatedException, and now I want my case to throw this exception, then I can catch it, but I don't know how to simulate such a selenium exception in my case, anyone knows?
Thanks!

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/73c94412-197a-4d2d-a8f5-81d134cbd829%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJPyTs0ud7R0EC%2BsUHiz6i8KpyEDk%2B8S_RZJjBt6YaMfyxZq5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to simulate the selenium exceptions?

total QA
In reply to this post by Summer Zhang
Hi Zhang,

First catch the Exception, verify its type of the Exception. You would not require to simulate it, but catch it verify to perform particular action.

try{

}
catch(Exception e)//Exception is a super-class for all exceptions.
    if(e instanceOf  SessionNotCreatedException)
   {

   }
   else
   {

   }
}

Regards,


On Tuesday, June 19, 2018 at 1:08:02 PM UTC+5:30, Summer Zhang wrote:
Hi,
I want to catch the selenium exception org.openqa.selenium.SessionNotCreatedException, and now I want my case to throw this exception, then I can catch it, but I don't know how to simulate such a selenium exception in my case, anyone knows?
Thanks!

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/09c62103-60c0-48af-904b-2a155560ddf6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.