Thursday, January 08, 2009

using Xpath way in Watir with Caution---slowness

i am used to write watir scripts to do the single user performance test or launch it under load test, it helps a lot when I want to get the response time from real user experience perspective.

but there is some situation i need to use Xpath to get the object which is to be clicked....
ie.button(:xpath, "//div[@id='ContentWrapper']/div/div[3]/a/img").click

i find it is realllllly slow when Watir is seeking the object within the Dom, i realize this way is not suitable for me to get response time,just for automation test maybe....

for almost situation i need to click the objects, i always use:
ie.link(:index,"118").click

or I change Post into Get method to get the same thing, for example:
Change : ie.button(:xpath, "//div[@id='ContentWrapper']/div/div[3]/a/img").click
into :
ie.goto "http://1.2.3.4/search.do?para1=performance&pageNumber=1"

so anyway, I like Watir, but using Xpath way in Watir with Caution, it is a little bit slow....

No comments:

Post a Comment