Home > other >  Selenium webdriver images click on the download link, computer program to die
Selenium webdriver images click on the download link, computer program to die

Time:09-28

Experts,
Out of interest hobby, I wrote a script automatically download the analysis results from the company website,
In the download, the following problems:
1. Use find_elements_by_tag_name found out the corresponding control (name as' ele);

2. The following code:
Print (' before ele click ')
ele. Click ()
Print (' after ele click ')

3. The web page download the pop-up dialog box, but never PYTHON code execution, stop in ele. Click ();


4. From the python console can also see the print (' after ele click ') has not been executed;


Experts, please help to see what's going on,

The other masters if you know of subsequent pop-up download dialog box, how to implement the save as?

Thank you very much!

CodePudding user response:

See screenshots seems IE browser?
Change the chrome
Idea is to initialize the webdriver, the closing of the browser downloads with extension parameter confirm
 
Options. Add_experimental_option (" prefs ", {
"The download. Prompt_for_download" : False,
})

CodePudding user response:

reference 1st floor nieoding response:
is likely to see screenshots IE browser?
Change the chrome
Idea is to initialize the webdriver, the closing of the browser downloads with extension parameter confirm
 
Options. Add_experimental_option (" prefs ", {
"The download. Prompt_for_download" : False,
})


A brother is a superior, see is IE. But this web page is company can only use IE... Do you know why this up in the? How to keep the back of the program?
Thank you very much!

CodePudding user response:

I checked the documents, IExplorer driver seems to be no offer to prohibit the download prompt launch parameters
Alternatively, can try to directly in the operating system level or an IE browser own set to close the download prompt,
I don't have a Windows environment, so can not trying, you can consult this article: https://superuser.com/questions/246553/how-to-disable-file-download-popup-in-internet-explorer

Above provides three methods for trying, I picked out
 
Solution # 1

Open Internet Explorer & gt; The Tools & gt; The Internet Options & gt; The Advanced & gt; Security:
Clear the 'Do not save encrypted pages to disk'.

Clear the 'Do not save encrypted pages to disk'

# Solution 2

Open Internet Explorer & gt; The Tools & gt; The Internet Options & gt; Security & gt; The Custom level & gt; Download:
The Select Disable the for 'Automatic prompting for file download'.
Repeat this for all 4 zones.

Disable automatic prompting for file download

# Solution 3

Open My Computer & gt; The Tools & gt; The Folder Options & gt; The File Types & gt; The PDF & gt; Advanced:
Clear the 'Confirm open after download'

CodePudding user response:

reference nieoding reply: 3/f
, I checked the document IExplorer driver seems to be no offer to prohibit the download prompt launch parameters
Alternatively, can try to directly in the operating system level or an IE browser own set to close the download prompt,
I don't have a Windows environment, so can not trying, you can consult this article: https://superuser.com/questions/246553/how-to-disable-file-download-popup-in-internet-explorer

Above provides three methods for trying, I picked out
 
Solution # 1

Open Internet Explorer & gt; The Tools & gt; The Internet Options & gt; The Advanced & gt; Security:
Clear the 'Do not save encrypted pages to disk'.

Clear the 'Do not save encrypted pages to disk'

# Solution 2

Open Internet Explorer & gt; The Tools & gt; The Internet Options & gt; Security & gt; The Custom level & gt; Download:
The Select Disable the for 'Automatic prompting for file download'.
Repeat this for all 4 zones.

Disable automatic prompting for file download

# Solution 3

Open My Computer & gt; The Tools & gt; The Folder Options & gt; The File Types & gt; The PDF & gt; Advanced:
Clear the 'Confirm open after download'


Thank you very much for your enthusiastic,
As you said, in a way of thinking, I don't have to PYTHON's control, download and use the mouse and keyboard control to implement,
My key issue or click () after hanging dead, don't know if the problem of PYTHON itself,
  • Related