Friday, November 8, 2013

Selenium Server 运行 HTMLSuite Selenese

You can run the HTML Suite Selenese script with the selenium-server.jar
The reference document is: http://seleniumhq.org/docs/05_selenium_rc.html
The sample command is:
java -jar selenium-server.jar -htmlSuite "*firefox" "http://www.google.com" "c:\absolute\path\to\my\HTMLSuite.html" "c:\absolute\path\to\my\results.html"

The real command executed by me is:
E:\Projects\Selenium\Google>java -jar C:\selenium-remote-control-1.0.3\selenium-server-1.0.3\selenium-server.jar -htmlSuite *firefox http://aws.amazon.com E:\Pr
ojects\Selenium\Google\AWS_Signin_Suite.html E:\Projects\Selenium\Google\AWS_Sig
nin_Suite_Report.html

Notes:
1. The selenium works as a proxy. It will retrieve all the embedded resources in a request on behalf of the browser. The selenium is much much slower while processing resources. So, you may need to set the timeout to 600 seconds
2. *chrome can be used to launch *firefox browser also.
3. -log option can be used to track the server side activities.
4. Sometimes, you may see "Socket: Read time out" exceptions. It is normal and does not mean the test case fails. Just be patient.

Selenium CSS Locator Tips

How to use nth-child?
nth-child can not return you the nth element in a matched set. It only return the elements who are the nth child of their parent nodes.

Why the Descendant selector does not work with nth-child?
It may be a Selenium bug.
This css locator will not work
css=div.application_details tr:nth-child(1) span.label
But the following one works
css=div.application_details tr:nth-child(1)>td span.label

It seems that Selenium gets confused after nth-child is used. We can use a direct child element to make the Selenium back to sane again. :-)

Top 10 Performance Techniques for PhoneGap Applications

by  on May 13, 2013 in PhoneGap


  1. TEST:  Test with the actual data and devices to feel the performance
  2. Avoid reflow: Modify the DOM once. Put all data together, then update the DOM. Not frequently update the DOM. 
  3. Do you really need the framework: Or you can just apply some CSS tricks to archive the same goal
  4. Limit shadows and gradients:
  5. Use CSS sprite sheets: Do not load each image individually
  6. Avoid click event 300ms delay: Use touch event
  7. Use hardware acceleration: Use CSS  transform: translate3d(-100%,0,0);  It will use GPU, instead of CPU.
  8. Cache everything: cache static content, cache templates
  9. Don't wait for the data to display the UI: display the UI, and update it when the data is ready. People do not wait on the UI, they are waiting for the data. 
  10. Don't generate the UI on the server