I'm working on a form filling software, and I was wondering how would I go about selecting a field via name attribute or even CSS selector/XPath (like in selenium) via a web browser? Instead of findbyid
?
Or Selenium RC is my only option?
You can use XPath to select your elements.
Examples are on this page: http://wiki.openqa.org/display/SEL/Help+With+XPath
Selenium supports many different locator types. Use the "xpath=" prefix for XPath locators, except where "xpath" is already in the method name.
//form//input[@name="myFormFieldName"]
EDIT To test on http://google.com
Command: type
Target: //form//input[@name="q"]
Value: TEST
After running this command, the input box on google.com should have the word TEST written on it.