Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
175 views
in Technique[技术] by (71.8m points)

python - In selenium, how can I go through a list and click a button one by one till the end?

I'm trying to automate a google takeout for a few gmail accounts. I'm currently stuck on when the export is ready to download. Google keeps splitting up the zips into 3-8 files. Even though I request a 50 GB export and the total size of the gmail account is maxed out at 30 gb. So I'm not sure why it keeps splitting it, but anyways. A pop up appears with a bunch of download links. How can I code selenium in python to be able to go through the list and click all elements that are there? enter image description here

Any help?

question from:https://stackoverflow.com/questions/65836371/in-selenium-how-can-i-go-through-a-list-and-click-a-button-one-by-one-till-the

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You'd do something like this.

elems = driver.find_elements_by_xpath("//a[@aria-label='Download']")
for elem in elems:
    elem.click()
    #driver.back()

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...