1

I am creating automatic testing using Windows Powershell to test a web gui. I need to get the value out of this:

<td> 
    Name:
</td>
<td id = "Name">
    Clark Kent
</td>

I was thinking I could access it the same as any other HTML element by using getElementByID("Name") but when I run this:

$doc = $ie.document
$name = $doc.getElementByID("Name")
write-host $name.value 

The output is just a blank string; and this:

write-host "The field is $name.value"

Outputs: "The field is mshtml.HTMLTableCellClass.Value"

Any idea how I would access this value?

1
  • Why don't you use something more highlevel like Watin? Commented Mar 30, 2011 at 5:16

1 Answer 1

1

Oops figured out the answer to my own question.

$name.IHTMLElement_innerText.Trim()

outputs Clark Kent. I needed to trim because otherwise there was a space at the end. I don't know if this was just for my case or for everyone so I included it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.