# Problem with automating Logon to a web site

**URL:** <https://forums.powershell.org/t/problem-with-automating-logon-to-a-web-site/13225>\
**Category:** PowerShell Help\
**Created:** [October 1, 2019, 9:23am UTC](https://forums.powershell.org/t/problem-with-automating-logon-to-a-web-site/13225 "2019-10-01T09:23:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nick2016](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/nick2016/32/25_2.png) [@nick2016](https://forums.powershell.org/u/nick2016)\
**Post date:** [October 1, 2019, 9:23am UTC](https://forums.powershell.org/t/problem-with-automating-logon-to-a-web-site/13225/1 "2019-10-01T09:23:30Z")

</div>

Hi,

I’m trying to automate logging onto a web site and I can get the username and password entered with the following code:

`$ie=New-Object -Comobject 'InternetExplorer.Application`

`$usernamefield = $ie.document.IHTMLDocument3_getElementByID(‘username’)`

`$usernamefield.value = $username …`

Where I am having an issue is with sending a click to the Login button.If I use by element or ID, it returns a null, I’m thinking it’s not finding the button?

The html is in the following screenshot.

[https://github.com/Nick-Rimmer2016/Snippets/blob/master/2019-10-01%2016\_12\_39-Window.png](https://github.com/Nick-Rimmer2016/Snippets/blob/master/2019-10-01%2016_12_39-Window.png)

&nbsp;

Thanks

Nick

&nbsp;

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:31pm UTC](https://forums.powershell.org/t/problem-with-automating-logon-to-a-web-site/13225/2 "2024-05-16T20:31:17Z")

</div>


