0

im trying to make an automation with Watin and i'm having an issue reaching to a text fill in an HTML body..

when i log into the site i manage to reach the search box and to put input there and even press "enter" when it moves to the second page, i cant reach the input form there

This is my code - first step is working smooth but second isnt.

 browser.GoTo("mywebsiteaddress");
        browser.TextField(Find.ByName("sysparm_search")).TypeText(ticketNumber.Text);
        System.Windows.Forms.SendKeys.SendWait("{ENTER}");

        //browser.TextField(Find.ByName("sys_display.sc_task.u_category")).TypeText(ticketNumber.Text);

        browser.Element("sc_task.work_notes");

This is the Browser source code when i check it with google chrome

<textarea wrap="soft" onkeypress="" onkeyup="multiModified(this);fieldTyped(this);" onfocus="this.isFocused=true;" autocomplete="off" data-charlimit="false" rows="16" id="sc_task.work_notes" data-length="4000" style="; width:100%; overflow:auto; " name="sc_task.work_notes" onblur="this.isFocused=false;" onchange="this.isFocused=false;multiModified(this)" onkeydown="multiKeyDown(this);;"></textarea>

Thanks all!

YonatanAr
  • 166
  • 7

2 Answers2

0

Use Fire fox. Install an add on by the name Firebug. Whichever element that you want to inspect, you right click on it and say inspect element with fire bug.

once you know the id or name of that element, you can easily access it using the Find class.

Sometimes it so happens that the element is in a different frame than the main frame. watin cannot directly access that element if it is not accessed via the frame.

Adwait
  • 23
  • 6
  • i get this details when i inspect the web page with google chorme.. anyway, its probably something that i dont understand how to get into the layer that contain the text box in it – YonatanAr Jan 16 '14 at 09:52
0

It could be a number of things including what you're looking for is in a frame or less likely you're looking for it before it is loaded. If in a frame, you'll need to specify which frame. If it is not loaded yet the easy way to check is by putting in a generic sleep() call, though that is not the best long term.

When I deal with something I can't find, I make heavy use of the Flash() method. In your case, you'd probably want to start at the whole page level and work your way down to your object. Flash() will show you where you're looking at to make sure you're looking in the right spot on the page, ideally getting down to the parent element of what you're looking for and being able to correctly identify and flash that and then figure out what is amiss with trying to get the textarea you're really trying to get at.

OCary
  • 3,231
  • 2
  • 16
  • 17