c# - How do I pass user/password to navigate method in a InternetExplorer.Application object -
I want to automate one thing in IE using the power shell, I have the following snippet:
$ i.e. = new object-com "InternetExplorer.Application"; $ Ie.navigate ('http://urlWithAuthentication.com'); This url has an http authentication, so the browser prompts for the user and the password, the previous script works fine, but I do not want to set the interactive user and password.
For example:
It does not exist, something similar looking $ ie.navigate ( 'http: // urlWithAuthentication .com', 'User', 'Password'); There is nothing about authentication in the method documentation
I have found the same questions but when there is a login page (i.e. the user / pass form) I am targeted to handle the built-in user / pass prompt of the browser.
I do not believe that COM The object is within the function because I have also seen it in the past, my own self Do not send the script username Wscript.Shell to use, press Tab, sent password and then send the enter. # setup object and open website $ ie = new object-com "Internet Explorer.Application"; $ Ie.navigate ('http://urlWithAuthentication.com'); $ passwordSent = 0 # Wait for the website to load ($ ie.ReadyState -ne4) {sleep-milliseconds 500 if ($ ie.ReadyState -q 1) {if ($ passwordSent -q0) {$ comShell = New-Object - Com "WScript Shell" $ Com Shell. Condache ($ password) $ com shell. Condenses ("{ENTER}") $ passwordSent = 1; }}
Comments
Post a Comment