-1

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?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Saulius Antanavicius
  • 1,371
  • 6
  • 25
  • 55

2 Answers2

0

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.

Matthew
  • 24,703
  • 9
  • 76
  • 110
0

Selenium isn't your only answer, but if you're trying to automate a web site, it's one of the few answers. A web browser alone won't do the job.

Ross Patterson
  • 9,527
  • 33
  • 48