SetAttributeValue and Web

Ask general questions here.
Uwes
Posts: 5
Joined: Wed Sep 02, 2015 8:13 am

SetAttributeValue and Web

Post by Uwes » Wed Sep 02, 2015 2:07 pm

Hello,

I've been trying to work with items on a website, i.e. using

Code: Select all

mytextbox.Element.SetAttributeValue("Text", "123");
Things that work in winforms don't work in the web.

Why? :roll:

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: SetAttributeValue and Web

Post by odklizec » Wed Sep 02, 2015 2:16 pm

Hi,

It works for me in my web-based tests. What kind of element is this "mytextbox" (HTML Input tag or something else)? Could you please post Ranorex snapshot of the element in question?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Uwes
Posts: 5
Joined: Wed Sep 02, 2015 8:13 am

Re: SetAttributeValue and Web

Post by Uwes » Wed Sep 02, 2015 4:30 pm

Seems to fail with any "text box" - like thing
including

https://de.wikipedia.org./wiki/Wikipedia:Hauptseite -> the "Search/Suchen" textbox top right. Seems to be a "input" html tag.

also the "pattern" textbox on
http://derekslager.com/blog/posts/2007/ ... ester.ashx

which is a textarea.

So

Code: Select all

Ranorex.Text 
does not abstract all that mess out? :? Got a quick sample code on how to add text to those two textthingies because I'm a bit stuck.

Thanks

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: SetAttributeValue and Web

Post by odklizec » Wed Sep 02, 2015 4:42 pm

OK, I missed there is used "Text" in your sample. You will have to use InnerText or better TagValue for the web-based inputs.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration