Hi,
I would like to identify a textbox (UITextField in iOS) by its "placeholder" attribute (the greyed out text visible before you enter anything).
I tried setting the XPath to /form/container/text[@placeholder='username'] for example, but it does not find the element.
Also, I could not seem to validate this property either (using an Xpath that works, like text[1]):
Validate.Attribute(repo.DemoRX.SomeContainer.UsernameInfo, "placeholder", "username");
Attribute 'placeholder' of element for item 'DemoRXRepository.DemoRX.SomeContainer.Username' does not match the specified value (actual='(null)', expected='username').
Is there any way of accessing the "placeholder" property? From code?
How to identify text control by placeholder attribute
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to identify text control by placeholder attribute
Hello,
Is there an entry for this property in the repository item?
You can use IntelliSense in order to check if this property is available for this repository item.
Regards,
Bernhard
Is there an entry for this property in the repository item?
You can use IntelliSense in order to check if this property is available for this repository item.
repo.DemoRX.SomeContainer.UsernameInfo.PlaceholderIf this is the case you can check the value using an if condition.
Regards,
Bernhard
Re: How to identify text control by placeholder attribute
It doesn't seem to have this attribute.
My code:
Errors:
'Ranorex.Text' does not contain a definition for 'Placeholder' and no extension method 'Placeholder' accepting a first argument of type 'Ranorex.Text' could be found (are you missing a using directive or an assembly reference?) (CS1061)
'Ranorex.Core.Repository.RepoItemInfo' does not contain a definition for 'Placeholder' and no extension method 'Placeholder' accepting a first argument of type 'Ranorex.Core.Repository.RepoItemInfo' could be found (are you missing a using directive or an assembly reference?) (CS1061)
Is there a way of using reflection, or similar method, to access properties not supported by the base Adapter classes?
My code:
Code: Select all
bool found = false;
if (repo.DemoRX.SomeContainer.Username.Placeholder == "123")
found = true;
if (repo.DemoRX.SomeContainer.UsernameInfo.Placeholder == "213")
found = true;
'Ranorex.Text' does not contain a definition for 'Placeholder' and no extension method 'Placeholder' accepting a first argument of type 'Ranorex.Text' could be found (are you missing a using directive or an assembly reference?) (CS1061)
'Ranorex.Core.Repository.RepoItemInfo' does not contain a definition for 'Placeholder' and no extension method 'Placeholder' accepting a first argument of type 'Ranorex.Core.Repository.RepoItemInfo' could be found (are you missing a using directive or an assembly reference?) (CS1061)
Is there a way of using reflection, or similar method, to access properties not supported by the base Adapter classes?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to identify text control by placeholder attribute
Hello,
You can also try to use the YourElement.GetAttributeValue("Placeholder") method in order to get the value.
If this will not work please send us a Ranorex Snapshot file in order to analyze the issue in more detail.
Regards,
Bernhard
You can also try to use the YourElement.GetAttributeValue("Placeholder") method in order to get the value.
If this will not work please send us a Ranorex Snapshot file in order to analyze the issue in more detail.
Regards,
Bernhard