Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Select value in dropdown menu on website

$
0
0

Hi guys,

I want to automate an annoying task that has to be done every month. So what needs to happen is:

1. Open website with url.

2. Click on a hyperlink.

3. Select value in dropdown menu.

etc..

 

Steps 1 and 2 are working, I just can't get step 3 to work. When I inspect the site, the dropdown name is as follows:

<select name="host_id" onchange="applyGraphPreviewFilterChange(document.form_graph_view)">

<option value="0">Any</option>

<option value="46" selected="">SOME OPTION HERE</option>

Some other options are:

<option value="12">ANOTHER OPTION 1</option>

<option value="14">ANOTHER OPTION 2</option>

 

So what I want is to select option 14 for example. What I have now is:

$IE.document.getElementById(“host_id”).Value="ANOTHER OPTION 2"

also tested it with value 14. I get back:

You cannot call a method on a null-valued expression.

 

I hope you guys can help me out.

 

Kind regards,

Toeter


Viewing all articles
Browse latest Browse all 6937

Trending Articles