Janp95
Janp95

Reputation: 584

Track Performance Robot Framework with stopwatch

I would like to track the performance with Robot Framework & Selenium2Library. When I click on an element a stopwatch must be counting en stops when the page is ready. Is it possible? I'm known with the DateTime library and tried something but it doesn't work.

Upvotes: 1

Views: 2372

Answers (1)

Würgspaß
Würgspaß

Reputation: 4820

Here is a simple example which measures the time that the page took to load some distinct element:

${start} =  Get Current Date
Open Browser    https://ixquick.com/
Wait Until Page Contains Element    //input[@id='query']
${stop} =   Get Current Date
${diff} =   Subtract Date From Date     ${stop}     ${start}
Log    ${diff}

You need Selenium2Library and DateTime library to run this. Adjust it to your needs, i.e. you have to find a definition of ready. This might be some HTML element to be present or some other criteria.

Upvotes: 5

Related Questions