FlutterLover
FlutterLover

Reputation: 671

How to click on an element by partial_link?

this is ths html code :

<a href="https://www.decathlon.ca/fr/12547-cyclisme" xpath="1">                                                        Cyclisme
                                                                                                        </a>

And im trying to click on this element by this code but not working (Timeout) :

    def click_cycling_menu(self):
    cycling_menu_id = WebDriverWait(self.driver, 50)
    cycling_menu_id.until(EC.presence_of_element_located((By.PARTIAL_LINK_TEXT, "12547"))).click()

Upvotes: 0

Views: 49

Answers (1)

RichEdwards
RichEdwards

Reputation: 3753

Can you use XPath contains functionality?

Feed this into find by xpath:

//a[contains(@href,"12547")]

Upvotes: 1

Related Questions