Pergunta

I have an ugly data entry task that needs automation. The problem is that some of the processes rely on web-based ajax services which have no API.

The problem with iMacros (or any other automation tool) is that whenever the macro injects javascript into a page (modifying ajax callbacks and doing all it needs to do), the child script has no way to notify the parent script that the task is ready, and let it continue the process in one single thread. If I use the WAIT instruction, reliability will be zero and there's no way to implement failsafes.

I tried anything I could think of, including Chrome Extensions, lowering XSS browser security and even replicating requests through cURL & PHP. Each one of these has its own limitations.

I'm open to any solution that:

  • can wait for a page to finish loading (onload events)
  • can modify the javascript on that particular page, interact with vars, etc.
  • can notify the parent caller that sub-tasks are completed and fire proper events
  • supports flash

Any alternative and help much appreciated.

Foi útil?

Solução

Here is a good article that is Selenium centric explaining different ways to wait for ajax requests to finish: http://agilesoftwaretesting.com/?p=111.

This is much cleaner than trying to modify the existing JS. Any of the following can be called from javascript directly, so as long as your automation framework supports calling javascript (which Selenium/webdriver does) then you just call these functions, depending on which ajax libraries your web site are using:

jQuery: “jQuery.active”

Prototype: “Ajax.activeRequestCount”

Dojo: “dojo.io.XMLHTTPTransport.inFlight.length”

Just check to make sure the value is 0 and then continue.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top