Creation – Day 1 (early morning)
by Dima

As a morning exercise, we propose to run first workable revision of Java tests (Revision 54). We assume that you have installed environment (Selenium and Java). Our short guide on how to do this can be found on page ‘Environment installation’.

It is important to have Recruiting application created on SalesForce platform (in fact, you only need to create Recruiting Web Site object in it for now).

While creating Recruiting application it is good to follow book instructions precisely. Otherwise tests will bring many errors and it will be hard to figure out what was the cause, in this early version of Selenium tests on Java. Current version of the same tests will explain all errors in a user friendly way but we will discuss it later in this blog).

If you do not have Recruiting application, you will be able to look at code and resulting log file only (link to log file will be provided in next post). But if you are like us – determined and hardworking – and have application, you only need to configure tests and Selenium launchers. All information below is for you to do it quickly and painlessly.

Firstly, we extract revision 54 from SVN repository…

Fig. 1 http://deepshiftlabs.com/svn/tests/trunk/salesforce/java

… Secondly, extract scripts which allow conveniently launch and stop Selenium Hub and RC. If you have own scripts or want to do it manually in a way described here – no problem.

Fig. 2 http://deepshiftlabs.com/svn/tests/trunk/salesforce/selenium_scripts

We can launch one RC or four with these scripts.

All main settings are in start_hub_rc.bat and detailed instructions are in README file. We will use this bat-file to start Selenium.

If you want to start four browsers – please read last paragraph in a README file. README also explains what to do to use IE instead of Firefox.

Fig. 3

We will now change file settings.java and put our SalesForce account username and password. We will create a folder to store screenshots and write its location into settings.java too. You will need to change BROWSER here too if you want to run on IE.

Fig. 4

All we have to do now:
- rebuild.bat – compile (we do it every time we change one of Java files)
- start_hub_rc.bat – stat Selenium Hub and RC
- run.bat – start tests execution
and enjoy the action.

Fig. 5

Additional information about software installation and configuration can be obtained from the following trusted and reliable sources:

Environment installation – how to assemble components to be able to run tests we will create.
First launch – simple test to check setup by logging into your SalesForce account.

Print this post | Home

2 comments

  1. Sim says:

    Hello,
    I would like to know if there is a way to record salesforce configurations like mobile configurations and/or approval processes using selenium IDE in one environment and make it work in other salesforce environments?

    The problems i got is mostly the recorded tests fail randomly. For the mobile configuration, while creating data sets, the ids of the objects are referenced. can i bypass the use of ids? I tried Xpath:position and css selectors but the css selectors do reference the ids.

    Any help would be much appreciated.

    Thanks
    Sim

  2. bear says:

    Hello, Sim.

    can i bypass the use of ids

    (Should notify in advance that we have not a big experience with Selenium IDE).

    Selectors which you can use with Selenium IDE are not limited by selectors proposed by it automatically.
    In complicated cases you should do some development to find proper locator. I advice you to start from this page.

    For example, if you know names of your objects in data sets (“mobile1″, “mobile2″), on your objects list you can use xpath like “//a[contains(text(),'mobile1')]“, that means “link which contains ‘mobile1′ text”.

    But Selenium IDE seems to not work with some xpaths. For example, if I have next links on page:
    “mobile001″,
    “mobile002″,
    “mobile003″,
    the “//a[contains(text(),'mobile')]” xpath should return 3 references, and each link should be accessed by something like “//a[contains(text(),'mobile')][1]“, “//a[contains(text(),'mobile')][2]” and so on, but I can access only first element this way.
    But it’s possible that there is some mistake in this xpath – I’m not expert in this.

    Hope it helps )