Selenium Builder – Exporting and execution

In continuation of my last blog, I will here share a more advanced capability of Selenium Builder.
Now as we are done with the set up we can talk one step ahead. Let’s start with an example :
I have opened a website in firefox and I want to automate some actions on this page. Let’s say :

 I want to open the URL (https://khyatisehgal.wordpress.com/).
I need to check a blog on this website, the very first one.
I want to see the author’s about my column.

In continuation of my last blog, I will here share a more advanced capability of Selenium Builder.
Now as we are done with the set up we can talk one step ahead. Let’s start with an example :
I have opened a website in firefox and I want to automate some actions on this page. Let’s say :

  1.  I want to open the URL (https://khyatisehgal.wordpress.com/).
  2. I need to check a blog on this website, the very first one.
  3. I want to see the author’s about my column.

And that’s all.

What I will do for this is,

  1. open the firefox
  2. launch the Selenium Builder.
  3. start doing the above steps.

And now Selenium builder will record all the steps like this:

SeleniumBuilderCapture

Now, stop recording, by clicking on the stop recording button.

What all you can do here?

You can customize your locators over name, id, class, CSS, paths (for more info over selenium see this). All you need to do is click on the locator you want to edit/update and just click Ok. Builder will show all options available and you can pick one.

CustomizeLocators

Exporting Commands from Selenium Builder to Eclipse IDE:

Exporting is a great feature of Selenium Builder where-in you can export your whole test case into the desired Programming Language.

Steps to perform export :

1. Click on the export button on the top of the menu bar under File.

ExportSteps

2. You will get a screen where-in you can select the type of export you want to continue with:

ChooseExportFormat

3. Then you can actually select the option, once this is done. You will get a pop up where you need to tell Selenium builder an option to which location you want to keep this exported file.

4. Once this is done, open this file and create a project in eclipse IDE or you can place this test case in your existing selenium project.

Lastly, you need to copy the code in Eclipse IDE. Here is the glimpse of code which you will get :

public class {
FirefoxDriver wd;

@Before
public void setUp() throws Exception {
wd = new FirefoxDriver();
wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}

@Test
public void () {
wd.get(“https://khyatisehgal.wordpress.com/”);
wd.get(“https://khyatisehgal.wordpress.com/”);
wd.findElement(By.cssSelector(“h1.entry-title > a”)).click();
wd.findElement(By.linkText(“ABOUT THE AUTHOR”)).click();
wd.findElement(By.cssSelector(“div.site-branding”)).click();
wd.findElement(By.linkText(“Twitter”)).click();
}

@After
public void tearDown() {
wd.quit();
}

public static boolean isAlertPresent(FirefoxDriver wd) {
try {
wd.switchTo().alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
}

And it’s done.

No coding, no locator finding, and you are there, ting-ting-tining !!!

Please share your experience /feedback if you have any with Selenium builder. I will be happy to connect to you 🙂

Author: Khyati Sehgal

Khyati has more than 12 years of experience in quality assurance engineering. Khyati has worked extensively on Manual and Automation testing of various technologies and domains like data quality. From last 6 years, She is leading QA Activities on Agile/Scrum projects while continuously contributing in playing role as a Scrum master, continuous integration, iteration planning, facilitating requirement analysis and closure. On automation front, She has explored gui, web services and mobile automation. Tools/ Technologies used:- Selenium/WebDriver, Core Java, JUnit, TestNG, Maven, SoapUI. Jenkins, Appium, Selenium backed and selenium remote driver. Have delve into android phone/tab of verison upto 6 (marshmallow), ios phone/i pad, and mobile websites

7 thoughts on “Selenium Builder – Exporting and execution”

  1. Hi Khyati,

    I am trying to open SeleniumIDE test cases in Selenium Builder but “open a script or sutie” button is not responding. Any ideas?

    Thanks
    Hema

    Like

    1. Hi Hema,
      What language you have chosen for creation of test suite, and in which language you are importing in selenium builder. can you please elaborate the case so that I can try the same on my local.

      Like

    1. Hello Jakir,
      You can directly use the exported file in the eclipse. For this you just need to create a new java/maven project, and export the file in a java class file.
      P.S. I have tried for java, this is applicable for other languages also.

      Like

  2. Hi — The exported java code does not run in Eclipse IDE. Can you please elaborate on the steps as I think there must be some configuration to be done for class name, jar files etc. to properly run this.

    Like

    1. Hi Vikas,

      I have tried with almost all the combinations it provides with java, can you kindly share the error log trace and the what combination have you tried in java, along with the specifications like Junit, Java, Testng versions, etc?

      BR,
      Khyati

      Like

Leave a comment