I'm trying to loop through a list of links on a webpage, clicking on each using selenium, then copying a tinylink from each page before finally returning to the master list page. So far it will access the page, but I'm struggling to get the sequentiality of
click link-> load page-> click 'share'-> click 'copy'
Currently it's accessing the master list page and going straight to clicking 'share' before clicking into the first link. Maybe I'm overthinking this, as I thought sleep(1) would cut the program there until the next step. Please help!
#below accesses each link, opens the tinylink, and copies it
powerforms = driver.find_element_by_xpath("//*[@id='main-content']/ul")
links = powerforms.find_elements_by_tag_name("li")
for link in links:
link.click()
sleep(1)
#clicks 'Share' button to open popout
share = driver.find_element_by_id("shareContentLink")
share.click()
sleep(1)
#clicks 'Copy' button to copy the tinylink to the clipboard
copy = driver.find_element_by_id("share-link-copy-button")
copy.click()
sleep(1)
break