Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
58 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 Reply

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...