Issue
I'm building a python Instagram bot, and I'm trying to get it to click on the DMs icon, but I'm not sure how to select it.
I tried selecting by Xpath, but I can't seem to be able to navigate it to the icon. Here's Instagram's html code for the DMs icon:
<svg aria-label="Messenger" class="_8-yf5 " color="#262626" fill="#262626" height="24" role="img" viewBox="0 0 24 24" width="24">
Any help is appreciated.
Solution
You have to apply a slightly different locator strategy to find svg
.
Here is what works:
driver.find_element(By.XPATH, "//*[name()='svg']")
assuming that this is the only svg element (as provided in your query)
Combination of more than one attribute from the same DOM line:
//*[name()='svg' and @aria-label='Messenger']
Answered By - Anand Gautam Answer Checked By - Katrina (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.