#sfse: xpath alternative for browser automation in ie
TRANSCRIPT
![Page 1: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/1.jpg)
XPath alternative for Browser Automation in IE
![Page 2: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/2.jpg)
About Me
Mridul Bansal Graduate Student, Software Engineering (Dec’11) San Jose State University Software QA Intern @Citrix, CA Software Test Development Intern @Hara, CA Software Test Engineer @Covelix, India http://www.linkedin.com/in/mridulbansal
![Page 3: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/3.jpg)
Problem Statement
Automation in IE using Webdriver!!!
![Page 4: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/4.jpg)
Caution!
n00b
Lot has already been said…
Take with a pinch of salt
![Page 5: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/5.jpg)
Caution!
IE9
![Page 6: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/6.jpg)
Why?
Dynamic id
XPath
Handles XPath differently
Painfully Slow
![Page 7: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/7.jpg)
Fix?
Increase timeout
CSS
Alternate locators
![Page 8: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/8.jpg)
iFix
Nokogiri (Ruby) http://nokogiri.org/ gem install nokogiri require ‘nokogiri’
![Page 9: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/9.jpg)
How?
Earlier @driver.find_element(:xpath => "//span[contains(., ABC')]").click
Now src = "<div id=""treeForm:tree:childs"">#{@driver.page_source()}</
div>" curr_id = Nokogiri::HTML(src).xpath("//div[@id =
'treeForm:tree:childs']/div[1]/div[2]/table[11]").attribute("id")
@driver.find_element(:id, curr_id).click
![Page 10: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/10.jpg)
Benchmarks
Test execution time on FF3.6 using
Webdriver = 3:00
Test execution time on IE9 using Webdriver = 4:50
![Page 11: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/11.jpg)
Alternatives
HtmlCleaner - http://htmlcleaner.sourceforge.net/
![Page 12: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/12.jpg)
References
http://nokogiri.org/ http://php.jglobal.com/blog/?
tag=selenium http://www.qaautomation.net/?p=216 http://blog.altom.ro/2010/10/selenium-
xpath-and-internet-explorer.html
![Page 13: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/13.jpg)
Credits
Selenium Meetup
Hara
Huynh Kang
![Page 14: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/14.jpg)
© 2011 Hara
/ confiden0al /
Page 14 Open House
![Page 15: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/15.jpg)
Appreciate in Public, Criticize in private… Recommend on LinkedIn!
© 2011 Hara
/ confiden0al /
Page 15 My Takeaway!
![Page 16: #SFSE: XPath Alternative for Browser Automation in IE](https://reader035.vdocuments.mx/reader035/viewer/2022062703/554d2c9db4c905ab268b5074/html5/thumbnails/16.jpg)
Thanks for bearing!!
Mridul Bansal Graduate Student, Software Engineering (Dec’11) San Jose State University Software QA Intern @Citrix, CA Software Test Development Intern @Hara, CA Software Test Engineer @Covelix, India http://www.linkedin.com/in/mridulbansal