Text box is "input-box large watermark"

Ranorex Spy, Recorder, and Studio.
ngrishakin
Posts: 42
Joined: Fri Oct 04, 2013 9:47 pm

Text box is "input-box large watermark"

Post by ngrishakin » Fri Nov 22, 2013 4:28 pm

I have a user name field on login page class is "input-box large watermark".
So the following code produces exception:

Host.Local.OpenBrowser("qa01.com", "firefox", "", false, false);
Ranorex.Text usrName = Host.Local.FindSingle("/dom[@domain='qa01.crowdtor.ch']//input[#'UserName']", 5000);
usrName.PressKeys("username");

Ranorex.CapabilityNotSupportedException was unhandled
Message=The element does not support the required capability 'text'.
Source=Ranorex.Core
CapabilityName=text
StackTrace:
at Ranorex.Adapter..ctor(Element element)
at Ranorex.Text.op_Implicit(Element element)
at CMS_test_hostLocal.Program.Main(String[] args) in c:\users\developer\documents\visual studio 2010\Projects\CMS_test_hostLocal\CMS_test_hostLocal\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Thanks a lot,
Nikolay

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Text box is "input-box large watermark"

Post by krstcs » Fri Nov 22, 2013 4:54 pm

You are trying to put in "input" adapter type into a "Ranorex.Text" object. This won't work.

Change this:

Code: Select all

Ranorex.Text usrName = Host.Local.FindSingle("/dom[@domain='qa01.crowdtor.ch']//input[#'UserName']", 5000);
to this:

Code: Select all

Ranorex.InputTag usrName = Host.Local.FindSingle("/dom[@domain='qa01.crowdtor.ch']//input[#'UserName']", 5000);
HTML objects are not the same as normal app UI objects, so you have to make sure you are using the right thing.
Shortcuts usually aren't...

ngrishakin
Posts: 42
Joined: Fri Oct 04, 2013 9:47 pm

Re: Text box is "input-box large watermark"

Post by ngrishakin » Fri Nov 22, 2013 5:04 pm

Thanks a lot!
Also I changed it to this
WebElement usrName = Host.Local.FindSingle("/dom[@domain='qa01.crowdtor.ch']//input[#'UserName']", 5000);
and it works.

- Nikolay

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Text box is "input-box large watermark"

Post by krstcs » Fri Nov 22, 2013 5:25 pm

Just remember that "Element" and "WebElement" are generic, and do not implement all of the actions that a specific adapter would, like "InputTag", so there are times when you will need to use the specific adapter.

I would recommend always using the specific adapter anyway, because it will still have everything the Element/WebElement does, but will force you to use it correctly and will be type-checked at compile time instead of run-time.

And, you are very welcome!
Shortcuts usually aren't...

ngrishakin
Posts: 42
Joined: Fri Oct 04, 2013 9:47 pm

Re: Text box is "input-box large watermark"

Post by ngrishakin » Fri Nov 22, 2013 6:05 pm

Thanks for your help. I'm trying to design test framework for our web application without using Ranorex IDE and repository. I want to reference Ranorex library in my VS 2010 project and use NUnit as a test framework.
So I can use RxXPath and Spy to refer to the web elements only.
I was looking around and cannot find a lot documentation how to do this in a right way.
For example, when I open my application in FireFox I can see in a spy two objects of the same page.
In my case it's a login page
One is a 'DOM Log On' and type is WebDocument and can be coded like this:
System.Diagnostics.Process.Start("firefox.exe", "http://qa01.crowdtor.ch");
WebDocument webDocument = "/dom[@domain='qa01.crowdtor.ch']";

The second one is 'Form Log On - Mozilla Firefox'
and I can refer to it as
Host.Local.OpenBrowser("qa01.crowdtor.ch", "firefox", "", false, false);
Form CMS = Host.Local.FindSingle<Form>("/form[@title='Log On - Mozilla Firefox']");

Both ways seems to work. But I have no idea what is the difference between these two methods and which one I should pick?

Thanks,
- Nikolay

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Text box is "input-box large watermark"

Post by krstcs » Fri Nov 22, 2013 6:54 pm

You will typically want to use the WebDocument ("dom") object, as this is the actual web page. The other is Firefox's presentation, and may not be consistent. Some objects will not be in the "Form" that are in the "Dom", especially some of the non-standard HTML stuff.

The WebDocument is presented by Ranorex's Firefox plugin so it should be better at representing the HTML.
Shortcuts usually aren't...

ngrishakin
Posts: 42
Joined: Fri Oct 04, 2013 9:47 pm

Re: Text box is "input-box large watermark"

Post by ngrishakin » Fri Nov 22, 2013 7:05 pm

Thanks a lot for all your help!!!

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Text box is "input-box large watermark"

Post by krstcs » Fri Nov 22, 2013 7:23 pm

You are welcome!
Shortcuts usually aren't...

ngrishakin
Posts: 42
Joined: Fri Oct 04, 2013 9:47 pm

Re: Text box is "input-box large watermark"

Post by ngrishakin » Fri Nov 22, 2013 8:00 pm

Can I replace System.Diagnostics.Process.Start("firefox.exe", "http://qa01.crowdtor.ch");
with another command like Host.Local.StartBrowser?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Text box is "input-box large watermark"

Post by krstcs » Fri Nov 22, 2013 9:48 pm

Sure. Behind the scenes they do essentially the same thing, but it is more concise and easier to understand, especially for non-coders.


On a related note, while I am a .NET developer myself, I have found that using the recording action table (you don't have to just record and play-back) with repository objects is very powerful and easy to maintain. There will be times when you need to write code, but for the most part, the more you do with the action table, the better off you will be. It will also make it easier for others to manage/change/maintain.

I do as little as possible in pure code. If I get hit by a bus tonight on the way home, I want the rest of the QA team (who, for the most part, aren't coders) to be able to pick as much of it up as possible.

Also, make your modules as small and atomic as possible. It will be easier to re-use a module that just clicks the "Continue" button, for example, than it would be to reuse one the flows through a whole website.

Then you can just string modules together in the test suite editor to get it to do what you want.

Anyway, experiment, play, and have fun!
Shortcuts usually aren't...

Deepak_Singh
Posts: 76
Joined: Fri Mar 14, 2014 2:37 pm

Re: Text box is "input-box large watermark"

Post by Deepak_Singh » Thu Mar 20, 2014 1:03 pm

Can we get user to put data during Run time.
Like in QTP we had InputBox for getting user input.
Please Help!!

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Text box is "input-box large watermark"

Post by krstcs » Thu Mar 20, 2014 1:25 pm

As the Ranorex team told you, many of the questions you have can be answered by reading the user manual. http://www.ranorex.com/support/user-guide-20.html

Anything that can be done in QTP can be done in Ranorex, plus a lot more, but you will need to learn how to do it. And you will probably want to learn VB.NET or C#.NET (I recommend C#).
Shortcuts usually aren't...

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

Re: Text box is "input-box large watermark"

Post by odklizec » Fri Mar 21, 2014 8:40 am

Here is how you can implement Input box in Ranorex:
http://www.ranorex.com/forum/moving-fro ... tml#p24814
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