views:

155

answers:

6

Hello.

I have a problem with fill the input field on my webaplication.

When i use selenium ide, and record my steps and next play in slow mode - all works good. But when i try to use that when i build a java script i have a problem.

On the selenium ide its looks like that:

selenium.type("//div[@id='startPoint']/div/div[2]/div[2]/input", "krakow");

when i run it on selenium rc i have error like:

ERROR: Element //div[@id='startPoint']/div/div[2]/div[2]/input not found

Anyone know how can i solve that problem ?

(sorry for my eng.)

A: 

There are a couple of places you could look (though it would be helpful to see more of your Selenium script, particularly the lines preceding the one in your question.

1) Sometimes the Selenium script records actions as selenium.click(...) rather than selenium.clickAndWait(...) which means that the script clicks on an input and then immediately tries to find the input box on a page which hasn't finshed loading yet. Changing selenium.click(...) to selenium.clickAndWait(...) should fix this.

2) Have you tried the 'find' button next to the target field in the IDE? E.g. is the path correct? Pause your script at the point where the input field should be populated and hit the find button.

Good luck!

Chris Knight
A: 

ok, so

in Selenium IDE after i format to java(junit) selenium rc it's looks like:

public void testUntitled() throws Exception {
    selenium.open("MY_PAGE");
    selenium.type("//div[@id='startPoint']/div/div[2]/div[2]/input", "krakow");
    selenium.click("//div[@id='[object trans.maps.RoutePanel]']/div/div[2]/div[1]/div[1]");
    selenium.click("//div[@id='undefined']/a/span");
}

}

i have only problem with -> selenium.click("//div[@id='[object trans.maps.RoutePanel]']/div/div[2]/div[1]/div[1]");.

Like i write earlier this works on SELENIUM IDE (addon for FF), but not in selenium RC.

piter
A: 

i still have a problem with that :/

Piter
A: 

Selenium recognises objects in many ways... for ex: with Id, Value, xpath, etc in this case it is using Id....and it is failing in RC So you can check the source of the web page and try with Value, then also if it doesn't works then you can try with the XPath.

A: 

i try with getting the xpath - /html/body/div[2]/div/div[2]/div/div/div[2]/div/div[2]/div/div/div/div/div/div/div[2]/div[2]/input

but i still have ERROR: Element /html/body/div[2]/div/div[2]/div/div/div[2]/div/div[2] not found

how can i try with Value ??

Piter
A: 

ok now all works.

selenium.type("//div[@id='startPoint']/div/div[2]/div[2]/descendant::input", "works!");

Thank you all for helping.

piter