Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selenium fields containing a word
#3
Hello :)

Kind of like:

if self.driver.find_element_by_xpath("//select[contains(text(), 'month')]"):
    print("FOUND! an element that contains the word 'month' has been found!")
    select = Select(self.driver.find_element_by_xpath("//select[contains(text(), 'month')]"))
select.select_by_index(2)
In this mockup if the find element contains a keyword (month in this example) it will randomly select a drop down value.

Does this make sense ok? :)

regards

Graham
Reply


Messages In This Thread
Selenium fields containing a word - by graham23s - Jul-23-2019, 07:43 PM
RE: Selenium fields containing a word - by graham23s - Jul-23-2019, 10:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Registration Form Fields rwahdan 2 1,999 Aug-09-2022, 10:35 AM
Last Post: Addweb
  [Intermediate] Key Word Scrapper with Python and Selenium MIPython 0 5,831 Dec-21-2017, 03:35 PM
Last Post: MIPython
  Error in Selenium: CRITICAL:root:Selenium module is not installed...Exiting program. AcszE 1 3,739 Nov-03-2017, 08:41 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020