Author Posts

September 12, 2013 at 10:20 am

Hi All,

Today I am stuck up with a new task where I need to access a url.
The url redirects me to a webpage where I have two input boxes and a submit button.
After inputting values I need to click on submit then I get a text string on the webpage.I need to capture that for my task.
Have gone through invoke-uri but got few errors in it.Any solution with simple example can help me out..

September 12, 2013 at 10:22 am

have you looked at the help file for Invoke-WebRequest ?
It has an example that might help you

September 12, 2013 at 10:52 am

Hi Richard,
Worked out few things with sample examples. Yet I thought we can share knowledge on real time exposure.
Anyways Got my solution through magazine on microsoft site only.:)

September 12, 2013 at 11:03 am

why don't you share you command or script which you used to solve the issue. so that I can improve my knowledge. thanks in advance....

September 12, 2013 at 10:40 pm

Am new to powershell automation. I was trying to use the following code for my task
PS C:\> $ie = new-object -com "InternetExplorer.Application"
PS C:\> $ie.navigate("http://servername/somelocation/Default.aspx")
PS C:\> $ie.visible = $true
PS C:\> $doc = $ie.document
PS C:\> $tb1 = $doc.getElementByID("TextBox1") ##Here i got error as below
Cannot find an overload for "getElementById" and the argument count: "1".
At line:1 char:27
+ $tb1 = $doc.getElementByID <<<< ("Textbox1") + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedErrorId : MethodCountCouldNotFindBest

October 18, 2013 at 7:32 am

Look at this. There maybe more than one element named Textbox1

$doc.documentelement.all|?{$_.src -match "Textbox1"}

Keep in mind you may receive an array of elements with the same name Textbox1 so handle as array to start.. Single row array logic the same as many row array logic, but not the same at all as single string logic.