Jump to content

python and selenium; failing to confirm if an xpath is present or not

12345678

basically in the website there might and might not be a box, so I wanted to make it check if that box does exist, and then if it exists run another piece of code.

 

to do that I got the xpath, since it looks like it has not an id or other sort of identification, but it doesn't work

 

https://pastebin.com/DMR20zBf

 

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, shadow_ray said:

That snippet is not even syntactically correct. And FindElement will throw if the element does not exist.

what's wrong with the syntax?

what can I use opposed to findelement?

 

I thinked to do two of those strings one if true run X string, and another one that if false, run Y string

 

nevermind I think that I've solved with try and else

thanks though

 

I thinked that I fixed, but I did not

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×