user9392307
user9392307

Reputation: 23

How can I use selenium with python to click on this type of sub menu links

I tried many things online but I cant find relevant subject in "inspect code" for Quora website. So can someone tell me how can I click this "Copy link" button(Shown in the attached pic) on quora using selenium. PS:You need to be logged into quora to see that button.

"Copy link button"

Upvotes: 1

Views: 59

Answers (1)

dhruv shah
dhruv shah

Reputation: 1

What you need to do is identify the top level div of that element: eg:

button = driver.find_element_by_id('__w2_wEahGopL52_icon')
button.click()

The parent should be in this order roughly:

svg -parent-> span (with class name : ui_button_icon) -parent-> **div** (use this div) 

next is clicking on the copy link button like so:

button = driver.find_element_by_class_name('CopyToClipboardShareLink')
button.click()

Upvotes: 0

Related Questions