Web driver unable to move the cursor from one control to another control
Hi to All,
I am new to selenium. I got a problem that selenium web driver is unable to move the control from one control to another control.
My code is running as follows:
Thread.sleep(3000); //Web driver entered input ‘Raghu’ in ‘Rival’ field
getObject("selectNameInQuickSearch").click(); // Web driver selected required value from search control
Thread.sleep(3000); //Now cursor is located at ‘Rival’ field.
After this web driver is unable to run the code.
getObject("txtRival").sendKeys(Keys.TAB); //From this line web driver is unable to run the code
new Actions(driver).moveToElement(getObject("txtMsgToR vival")).click().perform();
Once user starts typing letters in 'Rival' field, a quick search is displayed based on entered letters. Its like a google search.Once data entered in 'Rival' field, web driver is unable to move the cursor to next control.
Please suggest me any one to overcome this problem.
Thanks in Advance.
Last edited by RamKanuri; 12-20-2012 at 03:14 AM.
Some possibilities you can try investigating.
* Print out the CSS properties of the element at the point of failure, check if the element is out of the visible area.
* Check that there isn't a transparent element that's covering your target element.
* Often times hover overs might not behave the same when driven using selenium. It may not send the exact sequence events like all the mouse in, out, and over all the elements in between or parent containers. For example, if there's a link inside a list item tag, and the action is attached to the list item tag instead of the link inside. In this case, you might change the call to hover by coordinate for debugging purpose to check this.
Also keep in mind the goal of the test. Are you testing the UI, or do you need to do this to setup for the next step? You can perhaps navigate to link directly by pulling that property's href and getting the target page directly instead of navigating to it.
I got succeeded. Thank you very much.