I want selenium to support finding if an element exists

132 views
Skip to first unread message

吴永宁

unread,
Aug 25, 2022, 6:01:38 AM8/25/22
to Selenium Users
This is the case, when I use selenium in python, I need to detect whether an element of the current web page exists, so I hope that selenium can do this function

SiKing

unread,
Aug 25, 2022, 1:23:09 PM8/25/22
to Selenium Users
Use .findElements() - the plural version - and then test for the size of the returned list. If it is >0 the element is present, else it is not present.

SuperKevy

unread,
Aug 25, 2022, 2:26:29 PM8/25/22
to Selenium Users
Generally the selenium/webdriver info is out there and very easy to find with a browser search of the topic.

https://www.geeksforgeeks.org/find_element_by_id-driver-method-selenium-python/    
Also check out w3schools 

吴永宁

unread,
Sep 1, 2022, 12:38:20 AM9/1/22
to seleniu...@googlegroups.com
it worked,thank u so much :)

SiKing <mark....@gmail.com> 于2022年8月26日周五 05:23写道:
Use .findElements() - the plural version - and then test for the size of the returned list. If it is >0 the element is present, else it is not present.

On Thursday, August 25, 2022 at 3:01:38 AM UTC-7 rick...@gmail.com wrote:
This is the case, when I use selenium in python, I need to detect whether an element of the current web page exists, so I hope that selenium can do this function

--
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 selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b7744ed9-6b47-4374-81ac-c9695c122fbdn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages