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.

Workaround: Flash selenium test would not run in firefox 3.5 except when the browser mode is *firefoxProxy

I looked into flash selenium a few weeks back and i thought it was a great way for me to test certain part of the apps i have been ignoring for some time. However after knocking up a few test i discovered that my test would not run in my version of firefox (3.5). I got this error: INFO - Got result: ERROR: Threw an exception: NPMethod called on non-NPObject wrapped JSObject!

selenium failed to start browser in iexplore mode when selenium server is started dynamically in code

In a previous post, i have written about how i have been starting/ stoping the selenium server dynamically. What i didnt mention was that i was not able to run my tests using Internet Explorer. I got this error 11:56:55.272 INFO - Command request: getNewBrowserSession[*iexplore, http://localhost:8080, ] on session null 11:56:55.272 INFO - creating new remote session 11:56:55.381 INFO - Allocated session 688eff769c8b4751b5fb9477bba213f3 for http://localhost:8080, launching... 11:56:55.397 ERROR - Failed to start new browser session, shutdown browser and clear all session data java.

Search for a single digit within a string using regex as provided in java api

In my current work, i have been writing a lot of test in Java, which obviously means i need to learn a lot more about the Java api, which is good i think????? Well i needed to match the single digit in this string “home-area-1” and return this digit. With a quick google i found this piece of code here. Pattern p = Pattern.compile(“a*b”); Matcher m = p.matcher(“aaaaab”); boolean b = m.

Start the Selenium Server dynamically

I have been working on a test suite in java using testng as the testing framework. I could not have suggested any other test frame work as it allows me to do a lot of configurable setups and teardowns. Yeah am not gonna promote testng anymore, lol. I could have started using selenium server using a usual batch file that maven could call in one of its targets but i think doing it this way is cleaner.

Setting user extensions when the Selenium Server has been started dynamically

I hope this helps someone someday, I needed to set user extension for a selenium test suite, dynamically in the code as i was starting the Selenium server via same. public void startSeleniumServer(String port) { rcc = new RemoteControlConfiguration(); rcc.setPort(Integer.parseInt(port)); try { seleniumServer = new SeleniumServer(false, rcc); seleniumServer.start(); } catch (Exception e) { throw new IllegalStateException("Can't start selenium server", e); } } public void stopSeleniumServer() { if (seleniumServer != null) { seleniumServer.

Selenium Remote cant start firefox session due to lock on file

>I am sure you have on this page, because you have run into problem with selenium not been able to run due to a lock on some profile files. Yes, you know what the error is. I really found useful two blogs here and here. However, inas much as i don not want to repeat what has been saidin the blogs i would paste and quote what i found useful and explain a little bit more.

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.

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’.