Each day presents something new to learn.

Apart from Technical Topics, increasingly i find myself wanting to write about other topics that interests me - Entreprenuership and Business, Leadership, Africa, Service Industry (e.g Hotels, Restaurant). My writings would always represent my opinions and it might change from time to time.

css selectors in place of xpath for selenium locators

I have always resolved to using xpath whenever i am creating selenium scripts and i need to do locate elements with no ‘id’. Well as you would probably know, xpath executes so slow on IE. For intance i have a test suite that would run in 1hr 30mins on firefox/ safari but the same test suites would take over 4hrs to run to completion on IE.So with the help of a colleagues, i have been using css selectors from last week and i can say this has drastically improved the speed of our test and you would notice too much difference between IE and FF/Safari anymore.

Selenium Test execution speed on Safari vs Internet Explorer

I have been working on a selenium test suite that contains about 150 tests. These test would normally take about 4hrs 30mins for it to execute to completion. I tried to run same tests on Safari today, and it took exactly 1hr 9min. This is such a big difference and i think it is because of the extreme use of Xpath in the test suite. And as it is known thatXpath execute soooo slow in IE.

Not able to accept meetings in Outlook

Need to say i got an error displaying on the invite: This meeting is not in the calendar, it may have been moved or deleted. Discovered that when i click on the “Accept Button” for meetings which i have been invited, the Accept button doesn’t do anything. The invite sent to me,looks like this : Doing a bit of google got me this link, and it worked for me

Waiting for Elements in an IFrame on a WebPage to Load

>Waiting for a page to load while writing selenium scripts is pretty straightforward using the selenium.WaitForPageToLoad(“timeout”) timeout is time in millisecond. Sometimes using this command doesn’t work, especially when you the whole page is not loaded or reloaded but a popup is loaded in a div on the page. In situation like this i would used the selenium.WaitForCondition(”ScriptToReturnwhich ReturnTrue OrFalse”, “timeout”); e.g. of scripts would be selenium.WaitForCondition(selenium.browserbot.get CurrentWindow().document .getElement ById(‘idOfElement ToBelocated’)!

Need to get a value of an attribute using selenium

I was in this situation when i needed to get the value of an html attribute and i found the selenium.getattribute very handy ….. Okay the scenario was such that there was an element which is collapsible on the page and the only attibute for that element that indictated the status of the collapsible element was the ‘Class’. when the element was collapsed, the value of the class attribute was ‘asleep’ and when the element was expanded, the value of the class atttribute was ‘awake’.

Using selenium.GetEval(script)to execute Javascript

The task at hand was to navigate through the DOM of a particular webpage and check the style.display attribute of an object or element if you prefer. There are two elements on this page that displayed either success or failure messages.(msgSuccess and msgFailed) For perfomance reasons, if previously a successful message was displayed and subsequently the you get a failure message, what the developers of the page did was to amend the style.

Use selenium to create screenshot

I just stunbled across selenium as a tool to take screenshot. Thuis could be useful for anything. In my case i used it to take the screenshot of a page just before it throws an error in my selenium test. and that i could have a look and investigate what the problem might have been. very simple command and the great thing is it can be easily used for screenshots of a page across different browsers.

Selenium and Javascript events

Have you ver been in situattion when you have typed a value into a text box and you expect a Javascript event to be triggered such as “OnBlur” Well selenium has a method “FireEvent” which triggers the event for you, but then the trick is you have to strip the “on” and name for the event wouldbe “OnBlur” I guess abit of example would make more sense, lol. This is what my html look like

Selenium: Xpath locator can not be used as Option Locator

In my new job been doing a lot of selenium and i needed to scroll through the list of options in a select element and click on a particular options. I have initially used the browser.DoubleClick browser.DoubleClick(“xpath=//select/option[child::text()=‘Option_Label’]“);) But then this didnt work because selenium doesn’t have the functionality to scroll down the select element in other to make my desired option visible. Looking through the selenium api, i have used another method, which take in two parameters, the select locator and the option locator.