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

68 Views Asked by At

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"

1

There are 1 best solutions below

0
On

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()