Selenium WebDriver: Executing / Running UI Tests on a Remote Server


When do you need to run tests on remote servers -

    1. When your server doesn't have web browser and your tests need web browser to run successfully, in this case you will have to move to some other server which has web browser installed or run test remotely on the server where web browser is already installed.
    2. Or you want to run same test on different web browsers, which are installed on different remote servers having different Operating Systems in parallel.

There are different approaches to address above mentioned problems.

Either you can use RemoteWebDriver Server to solve first mentioned problem above (which will help you to run test on remote server) Or in both the cases you can use Selenium GRID.

Please find details below -

1. RemoteWebDriver Server

The RemoteWebDriver is composed of two pieces: a client and a server. The client is your WebDriver test and the server is simply a Java servlet, which can be hosted in any modern JEE app server. The server will always run on the machine with the browser you want to test. There are two ways to user the server: command line or configured in code.

a. Starting the Server from The Command Line
Once you have downloaded selenium-server-standalone-{VERSION}.jar place it on the computer with the browser you want to test. Then from the directory with the jar run the following

You can download 2.47.1 version directly or from here get the latest once (under Selenium Standalone Server section)

java -jar selenium-server-standalone-{VERSION}.jar

b. Once server is UP, you will see below message in your terminal window -

$ java -jar selenium-server-standalone-2.47.1.jar
23:04:53.282 INFO - Launching a standalone Selenium Server
23:04:53.619 INFO - Java: Oracle Corporation 25.60-b23
23:04:53.620 INFO - OS: Windows 7 6.1 amd64
23:04:53.628 INFO - v2.47.1, with Core v2.47.1. Built from revision 411b314
23:04:53.679 INFO - Driver class not found: com.opera.core.systems.OperaDriver
23:04:53.679 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
23:04:54.081 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
23:04:54.081 INFO - Selenium Server is up and running

c. Now try to connect to this server from your test, where you will be using RemoteWebDriver.
Please refer sample code below -

Repeating text within a document

Scenario: You have some text in a Word document that you’d like to repeat later in that document. You don’t want to write it twice (or more), and you’d rather not copy/paste it from the other location as that means that you’ll have to remember to maintain it in both places if there are changes. If another author takes over the document, they may not know that they have to update this text in two or more places if there are changes, either.

Solution: Bookmarks!

You assign a bookmark to the text you want to re-use, then insert a cross-reference to the bookmark text. Whenever you change the original text, you only need to update the fields in the document for the changes to apply to the second (or third) instance of that text.

Here’s how:

  1. Select the block of text you want to repeat later in the document. This text can be a phrase, one or more paragraphs, a bulleted list, a table, etc.
  2. Insert a bookmark for the selected text (Word 2007: Insert tab >Bookmark).
  3. Give the bookmark a meaningful name, click Add, then click OK.
  4. Go to the place in the document where you want to re-use the selected text.
  5. Insert a cross-reference (Word 2007: References tab > Cross-reference).
  6. Select Bookmark as the Reference Type, and Bookmark Text as the Insert option.
  7. Select the bookmark name you added in Step 3, then click Insert.
  8. Whenever you change any text in the original list, just click inside the other list, then press F9 to update it (or Ctrl+A then F9 to update ALL fields in the document).

thanks!

How to Create a Meeting Request from an E-Mail Message in Outlook 2007

Q. How to Create a Meeting Request from an E-Mail Message in Outlook 2007?

This might be the question to many of the old Outlook user who is still using Outlook 2007 version or older, that how to directly convert mail into a meeting request.

Recently due to company change, I moved from 2013 version to 2007, and for some reason I wanted to convert my mail into a meeting request but even after doing some research I didn't find any option on Outlook 2007 GUI but there is a small trick to convert mail into meeting request in Outlook 2007.. 

Quick tip to save time converting e-mail messages to meeting requests: 
  1. In Outlook 2007, Drag an e-mail message to the Date Navigator (the small calendar in the To-Do Bar). 
  2. A Meeting Request opens with the Subject line filled in and the e-mail message in the body. 
  3. Add more details to the meeting, and then click Invite Attendees, & send meeting request!
Please refer screenshots below for the reference - 


I hope this helps. Have a good day!

How to setup Selenium WebDriver with TestNG, JUnit, Maven & ReportNG in Eclipse

I have seen this question posted in many forums "How to setup Selenium WebDriver with TestNG" or just "How to setup Selenium WebDriver in Eclipse", and I have also seen many good articles suggesting step by step information on how to setup Selenium 2.0 (WebDriver) with Eclipse but never seen some directly providing Java project with all the details.

I have tried creating one simple setup which includes Eclipse and with Selenium 2.0 WebDriver Java project. Java project has following plug-ins installed, you can use them as per your requirements in your test automation project.

Zip includes following:
  1. Eclipse IDE for Java and DSL Developers - Downloaded it from eclipse.org, and it has following plugins already added.
    1. Maven 
    2. TestNG 6.1.
  2. Java project with following libs added in Maven pom.xml
    1. Selenium 2.0 (Java WebDriver) 2.44.0
    2. JUnit 3.8.1
    3. ReportNG 1.1.4 
    4. Guice 3.0
If you want to use some other eclipse version and if you want similar setup for that eclipse version then please let me know, I will be very happy to provide / build setup for you.

To Download SeleniumWebDriver_With_Eclipse.zip with all above mentioned plug-ins & Java Project, please click on below image.

How to change JRE version of your Java project in Eclipse

1. Open Eclipse and right click on your Java project, select "Properties"

2. Select "Java Build Path" and go to the "Libraries" tab as shown below.

3. Select the already available JRE library and click on "Edit" button present on right side. You will see one more new windows called "Edit Library" as shown below.

WebDriver is not able to find out WebElement present on Web Application

Recently came across one of the problem and I think it would be helpful to everyone if I share the details.

Problem Statement: WebDriver was not able to find out WebElement

I was using Firefox WebDriver, and in one of my test WebDriver was not able to find out Link / Image / Button for some reason.

HTML page Code look like below: I want to click on "New" link/image.

<div id="toolcontainer">
       <ul id="toollist">
              <li>
                     <a id="btnNewDash" title="New" onclick="javascript:$('#addTab').dialog('open'); return false;" href="#">
                            <span class="toollistimg"></span>
                            <span class="toollisttext"></span>
                        </a>
                 </li>
              <li></li>
          </ul>
   </div>

But when I use below code in my test, it didn't work... I tried following -
Related Posts Plugin for WordPress, Blogger...
Powered by Blogger