{"id":5722,"date":"2017-05-09T18:46:43","date_gmt":"2017-05-09T22:46:43","guid":{"rendered":"http:\/\/www.webperformance.com\/load-testing-tools\/blog\/?p=5722"},"modified":"2017-05-09T18:56:12","modified_gmt":"2017-05-09T22:56:12","slug":"how-to-convert-selenium-scripts-to-virtual-browser-scripts","status":"publish","type":"post","link":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/2017\/05\/how-to-convert-selenium-scripts-to-virtual-browser-scripts\/","title":{"rendered":"How to Convert Selenium Scripts to Virtual Browser Scripts"},"content":{"rendered":"<p>Web Performance has discontinued direct support for Selenium\/WebDriver in <a href=\"\/load-testing-tools\">Load Tester<\/a>. One of the limitations of load testing with Selenium\/Web Driver is that it takes lots and lots of cloud machines to generate load. Virtual users, on the other hand, are very efficient, cheaply simulating up to millions of users. This blog post shows one possible option, playing back your selenium scripts directly into the Load Tester recorder where they can be edited and played back with lots of virtual users.<\/p>\n<h2>Install Load Tester<\/h2>\n<p>Download Load Tester and install it on your Windows machine if you haven&#8217;t already. \u00a0Double-click on the installer and follow the instructions.<\/p>\n<h2>Install Firefox and the Firefox SSL Certificate<\/h2>\n<p>Since Selenium IDE runs inside Firefox it will be need to be configured to record with Load Tester. Note that this process also works if you&#8217;ve written selenium scripts in a programming language, but in that case wherever the instructions say to start playback in the IDE you&#8217;ll have to do that within your programming environment.<\/p>\n<p>You should already have Firefox installed if you&#8217;re using Selenium, but if not, download and install it now. Recording with Firefox from Load Tester will automatically install\u00a0the special SSL certificate needed to enable recording.<\/p>\n<p>To do this first click on the red Record Button, below.<\/p>\n<p><a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/record-screenshot.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5728\" src=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/record-screenshot.png\" alt=\"\" width=\"600\" height=\"446\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/install-ssl-certificate.png\"><br \/>\n<\/a><\/p>\n<p>Then select the Firefox icon:<\/p>\n<p><a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/browser-chooser.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5729\" src=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/browser-chooser.png\" alt=\"\" width=\"600\" height=\"339\" \/><\/a><br \/>\nThe program will then ask you to install the SSL certificate:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5727\" src=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/install-ssl-certificate.png\" alt=\"\" width=\"600\" height=\"372\" \/><\/p>\n<p>Click on the stop recording button to stop the recording process for now so we can complete the configuration process.<\/p>\n<h2>Configure HTTP Proxy Settings<\/h2>\n<p>For recording to work Firefox&#8217;s HTTP proxy must be configured to route HTTP traffic through Load Tester. Go to Firefox&#8217;s proxy settings and use the IP address 127.0.0.1, and the port<br \/>\n2525 for HTTP and 2526 for SSL. Menu-&gt;Options-&gt;Advanced-&gt;Network.<\/p>\n<p><a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/firefox-proxy-settings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5730\" src=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/firefox-proxy-settings.png\" alt=\"\" width=\"600\" height=\"557\" \/><\/a><\/p>\n<p>Load Tester normally randomly generates its own port values. For this to work you&#8217;ll need to turn off that feature. From within Load Tester\u00a0go to Window-&gt;Preferences-&gt;Load Tester-&gt;Recording and make sure &#8220;Manually Select Recording Ports&#8221; is checked.<\/p>\n<p><a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/recording-ports.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5731\" src=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/recording-ports.png\" alt=\"\" width=\"601\" height=\"495\" \/><\/a><\/p>\n<h2>Playback and Record a Selenium Script<\/h2>\n<p>Start a recording in Load Tester again by clicking on the red record button:<\/p>\n<p><a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/record-screenshot.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5728\" src=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/record-screenshot.png\" alt=\"\" width=\"600\" height=\"446\" \/><\/a><\/p>\n<p>This time, however, instead of selecting Firefox, click on\u00a0Show More Options:<\/p>\n<p><a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/browser-chooser.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5729\" src=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/browser-chooser.png\" alt=\"\" width=\"600\" height=\"339\" \/><\/a><\/p>\n<p>This will bring up the option to do system-wide HTTP recording. Select &#8220;No Browser &#8211; Capture Systemwide Traffic&#8221;, and click &#8220;OK&#8221;.<\/p>\n<p><a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/Screen-Shot-2017-05-03-at-11.39.03-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5737\" src=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/Screen-Shot-2017-05-03-at-11.39.03-AM.png\" alt=\"\" width=\"600\" height=\"381\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Once Load Tester recording has started you can then initiate playback either from Selenium IDE or by starting a programming language script containing Selenium\/WebDriver code. \u00a0 To start Selenium IDE go to the Firefox menu and select Selenium IDE:<\/p>\n<p><a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/Screen-Shot-2017-05-03-at-11.41.26-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5735\" src=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/Screen-Shot-2017-05-03-at-11.41.26-AM.png\" alt=\"\" width=\"600\" height=\"484\" \/><\/a><\/p>\n<p>If you&#8217;re using Selenium IDE be sure to select the slowest playback speed so that Load Tester can group the HTTP requests into web pages by moving the speed slider all the way to the right to &#8220;Slow&#8221;:<\/p>\n<p><a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/Screen-Shot-2017-05-03-at-11.47.18-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5741\" src=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/Screen-Shot-2017-05-03-at-11.47.18-AM.png\" alt=\"\" width=\"600\" height=\"300\" \/><\/a><\/p>\n<p>When playback has started you should notice that web pages are starting to show up inside Load Tester:<\/p>\n<p><a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/Screen-Shot-2017-05-03-at-11.42.18-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5740\" src=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/Screen-Shot-2017-05-03-at-11.42.18-AM.png\" alt=\"\" width=\"598\" height=\"178\" \/><\/a><\/p>\n<p>When playback finishes click on Load Testers big &#8220;stop recording&#8221; button.<\/p>\n<h2>Separate Web Pages<\/h2>\n<p>Load Tester uses the natural rhythm of real users to separate out HTTP requests into web pages, but Selenium IDE will try to play back the requests as fast as possible, even on slow mode, with no think time like a real user. \u00a0This can sometimes cause the page groupings to be off. \u00a0To fix this,\u00a0expand the web pages one by one, and see if you can identify the start of a new web page. \u00a0When you find one, right-click on it and select &#8220;Start new Web Page with URL&#8221;. \u00a0This will create a new web page grouping with that URL and any subsequent URLs already in the current web page.<\/p>\n<p><a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/Screen-Shot-2017-05-03-at-11.51.59-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5743\" src=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/Screen-Shot-2017-05-03-at-11.51.59-AM.png\" alt=\"\" width=\"600\" height=\"442\" \/><\/a><\/p>\n<p>The recording should now have recognizable web pages more like from the Selenium script:<\/p>\n<p><a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/Screen-Shot-2017-05-03-at-11.54.17-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5745\" src=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-content\/uploads\/2017\/05\/Screen-Shot-2017-05-03-at-11.54.17-AM.png\" alt=\"\" width=\"600\" height=\"124\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>Configure The Script<\/h2>\n<p>Now that the test case is in Load Tester there&#8217;s a wide variety of customizations available. \u00a0The most common is to configure data replacement, so that each user has a separate user name and password, for example, or types in separate information into forms. \u00a0There are a <a href=\"\/library\/tutorials\/index.html\">large number of tutorials<\/a> available, or just type your question into the search bar and search the entire site.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Web Performance has discontinued direct support for Selenium\/WebDriver in <a href=\"\/load-testing-tools\">Load Tester<\/a>. One of the limitations of load testing with Selenium\/Web Driver is that it takes lots and lots of cloud machines to generate load. Virtual users, on the other hand, are very efficient, cheaply simulating up to millions of users. This blog post shows one possible option, playing back your selenium scripts directly into the Load Tester recorder where they can be edited and played back with lots of virtual users.<br \/>\nInstall Load Tester<br \/>\nDownload Load Tester and install it on your Windows machine if you haven&#8217;t already. \u00a0Double-click on the &hellip; <a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/2017\/05\/how-to-convert-selenium-scripts-to-virtual-browser-scripts\/\">Continue reading &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[197,42],"tags":[],"class_list":["post-5722","post","type-post","status-publish","format-standard","hentry","category-real-browser","category-load-tester-software"],"_links":{"self":[{"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/posts\/5722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/comments?post=5722"}],"version-history":[{"count":12,"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/posts\/5722\/revisions"}],"predecessor-version":[{"id":5748,"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/posts\/5722\/revisions\/5748"}],"wp:attachment":[{"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/media?parent=5722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/categories?post=5722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/tags?post=5722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}