English 中文(简体)
Prototyping selenium Xpath paths in Firefox
原标题:

I m using selenium in my test suite, but since it s slow to set up, I d like to prototype my xpaths on live pages, rather than waiting for tests to run. Is there a good way to do this?

  • Firebug s $x xpath seems to not work very well
  • jQuery doesn t seem to support Xpath selectors natively, though it used to in version 1.2.
  • using the native javascript stuff (document.evaluator(...)) is verbose and doesn t return lists, making it irritating to use.

What s a good solution? Perhaps there s a way to use selenium as a nice REPL directly?

最佳回答

Download the Selenium IDE Firefox plugin. It has what you re looking for and more.

You can enter an xpath, and it ll highlight the resulting elements for you. There s also drop-downs to select the Selenium functions you want to invoke.

It also adds context sensitive entries to your context menu (right click some text, then "AssertEquals" on it for example.)

问题回答

Use the XPather add-on for Firefox. I always use it to check out my XPaths.

Also consider using TestPlan to write your tests. It has Selenium and HTMLUnit as a backend. Since HTMLUnit doesn t open a browser your tests run a lot quicker. Once everything is working with HTMLUnit you can just run in Selenium mode and have the same test work in the browser.

http://testplan.brainbrain.net/

Firefinder is a nice plugin too, maybe slightly nicer than firebug, maybe not.





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签