问题
I am trying to download some files with python selenium after authentication, but when selenium clicks the file link it opens a new window and therefore it is asking for authentication again. Can I force selenium to download file without opening new window or in new tab using same auth?
elementList = driver.find_elements_by_class_name("file-link")
for el in elementList:
el.click()
Update 1:
elementList = driver.find_elements_by_class_name("file-link")
for el in elementList:
driver.execute_script("arguments[0].setAttribute('target', 'self')", el)
el.click()
But still getting multiple windows.
来源:https://stackoverflow.com/questions/50611045/python-selenium-opens-a-new-window-on-click-instead-of-tab