How to click in the link in a herf and the link is string
<a href="/pages/creation_flow/?step=profile_pic&draft_id=597215097432581&page_id=11020432423337" id="u_0_1_sX" data-sigil="no_mpc">تخطي</a>
CodePudding user response:
Generally, it can be done by clicking the element itself.
In case this locator is correct and unique you can do it as following:
driver.find_element_by_xpath('//a[contains(@href,"/pages/creation_flow/?step=profile_pic")]').click()
I can't be sure about the locator since you dint share a link to the page or the entire page HTML.
Also you probably will need to add some delay before accessing it.
CodePudding user response:
To click on the element with text as تخطي you can use either of the following Locator Strategies:
Using link_text:
driver.find_element(By.LINK_TEXT, "تخطي")
Using css_selector:
driver.find_element(By.CSS_SELECTOR, "a.inv[href^='/pages/creation_flow/?step=profile_pic']").click()
Using xpath:
driver.find_element(By.XPATH, "//a[@class='inv' and starts-with(@href, '/pages/creation_flow/?step=profile_pic')][text()='تخطي']").click()