My blog has moved!
You should be automatically redirected in 5 seconds. If not, visit http://samueladesoga.wordpress.com and update your bookmarks.

Monday, 11 April 2011

My notes from the selenium conference 2011

I had the opportunity to attend the selenium conference and loads of good stuff, i must tell you. This post is an attempt to highlight the conference talks/ seminar that i really enjoyed.

1. Page Object 101: This was a workshop delivered by Patrick Wilson Welsh and Adam Goucher. Even though I have done a lot of page objects in the past, at a glance i like the way patrick has approached html elements, (wraping each html elements in a class), it feels like writing selenium code in a watir way.

The full source code of Patrick's work be found here:

https://github.com/PillarTechnology/SeleniumPatterns/tree/master/selenium-rc-patterns


I hope to have a closer look, and learn one or two things to do page object better in the future. Note that Patrick's work has been done in selenium 1.

2. There were a number of talks about what Selenium 2 bring to the testing table. I noted a few things from several workshops and presentations.

- Generally Simon Stewart claims that Selenium 2 is much more faster than Selenium 1. This should be evident i believe from some example i hope to explain below.

Locating Elements by XPaths

- If i have the followin code snippet in selenium 1:
selenium.click("//div[@id = 'some_id']//*[@class = 'some_class']");

This would be written as:
driver.findElement(By.id('some_id')).findElement(By.className('some_class')).click;

From the example above, this eliminates the need for the use of xPath and as a result would increase the speed of such tests.

Waiting For Elements to Appear

In selenium 1, if you use the Wait class you would do

new Wait("Couldn't find close button!") {
boolean until() {
return selenium.isElementPresent("button_Close");
}
};
In the code snippet about, the test would spend have some time to wait for the element to appear, and then you would something like:

selenium.click("button_Close");

In selenium 2, this would be replaced with

WebElement close_button = new WebDriverwait(driver, 10).until() {
driver.findElement(By.id('button_Close'));
}

close_button.click();

The difference is that the 'until' methods of the WebDriverWait class waits until the condition evaluates to a value that is neither null nor false. So this means it would return any object be it boolean or a WebElement object.
NB: note that the code is for illustration, you might need to tweak for it to work properly.


Sleeps

In the talk by Dante Briones, I can remember a section in which he talked about the dangers of using sleeps in tests and I loved his suggestions of wrapping Thread.sleep() in an appropriately named methods such as:

couldNotDoTheNeccessaryHardWorkAsIWasLazy();

I think the morale of the story is that using sleep in your tests is evil.
Nice :)

3. There were also several sessions around Web Performance testing and this was more educating for me as i learnt a few things that i hope to explore in great depths in the future
- I learnt about the BrowserMob proxy which can be used as a DesiredCapability in association with Firefox2. These can also be used for blacklisting/whitelisting urls, redirecting urls, setting internet speed and many other uses.

- Also learnt that we can do similar things with the FiddlerCore Api but this would only work on .Net platforms.

- There was also a slide about platform specific tools that can be used to capture performance metrics. Tcpdump for windows platforms and PCap for linux/ Unix platforms.


its always nice to know about more tools that would make me a better technical tester and i hope to explore these tools in depth at a future date.

4. At the end of the conference, Simon Stewart took a few of us through the selenium source code and he was talking about how to build the source. I can guarantee that it would have been impossible to build the source without someone holding your hand (not literarily). I learnt that the build scripts is based on rake, but the guys have a build grammar called 'crazy-fun'.


As i use selenium more and more, i am hoping to be able to contribute to this wonderful tools, but i still have a lot of personal work to do in other to understand all that simon said at that talk.

There were loads of other talks at the conference and as soon as the source code / slides / videos are posted. I would update this post with some more links.


Enjoy!!!

Wednesday, 22 December 2010

Rails3 'link_to' displays literal HTML on front end

In the last month, I have been working on a rails3 app and I ran across this interesting problem where I need to create a href link to a another page from my current page.

In my view i have written

<%= "Please click on this link #{link_to('here', new_house_path)}" %>

And interestingly this is displayed as

Please click on this link <a href="http://localhost:3000/houses/new">here</a>

on the front end.

Hours of frustration and google searches leads me to doing this:

<%= ("Please click on this link #{link_to('here', new_house_path)}").html_safe %>;

which then is displayed correctly on front end

Please click on this link here

if that isnt clear enough, the trick is you need to wrap the string with a 'html_safe' method

Off i go to learn more stuff .....

Tuesday, 12 October 2010

Installing mysql on snow leopard

I have always struggled with install mysql on my snow leopard, as a result i have decided to keep a link on this blog for this:

http://www.icoretech.org/2009/08/install-mysql-and-mysql-ruby-gem-on-snow-leopard-64-bit/


Hopefully that link would be up for a very long time and i hope it is useful for someone else as well.

Friday, 3 September 2010

A tester's reflection on kanban plus BDD

So i have just finished an engagement with a client where the development process used include
kanban and BDD. Kanban for us meant that we give priority to work on the right side of the board.
So as a tester, I would rather spent my time doing some manual testing on a story that is in the QA queue, than writing automated acceptance tests for a stroy in the queue for Accetance Tests.

Maybe it would be worth while to draw a representation of the way in which work flows through our kanban board

Analyis > Queue > Accetance Tests in Progress > Queue > Dev in progress > Queue > QA in progress > Smoke Test > Queue > UAT Deployment in progress > Queue > UAT in progress > Queue > Live Deployment in Progress > Deployed.

The good thing is that everyone in the team has a visibility of work up till deployment. For more information, read up kanban

The BDD framework used was Cucumber + Watir + Rspec, and developers would only start developing software when the tests have been written for the acceptance criteria. (Acceptance criteria is written by Analysts in a text editor in the cucumber format). The acceptance tests is jointly owned by developers and testers. If as a tester i am busy doing some other tasks further down in the work flow, the developers were happy to write the failing automated test for the acceptance criteria before development commences.

As a result of these good practices:

1. The team was always in good spirit and which improves the effectiveness
2. The number of defects raised was low, this was achievable because for a developer to move a story to the QA queue, the automated acceptance criteria must have been passing.
3. There wasnt a defect management system because testing is carried as close to the development time, and if the business believes the defect is critical to the functionality, the functionality of story does not progress further in the kanban board, but it is blocked until fixed and verified.

One downside is that because we wrote acceptance test for virtually every functionality that is testable, the acceptance test grew so quick that the time taken increased from about 20mins to about 1.40mins and this time kept growing. A side defect of this is that feedback time increased and as a result developers would not run the complete test suite before checking their code in. This was however managed by doing some exploratory manual testing around the functionality being developed.

All in all, it was a good experience for me and i just hope i get to work on more projects such as this.

Friday, 25 June 2010

Watir: Search for elements on page using multiple attributes

I ran into a situation today where i wanted to scan through a page and return a table based on the table matching 3 attributes

Before:

browser.tables.find do |table|
table.class_name == 'my_class_name' and
table.cell(:class, 'class_1_name').text == 'some_text_1' and
table.cell(:class, 'class_2_name').text == 'some_text_2'
end

This was taking about 3minutes as there were about 86tables on this page under test. I was worried but the tables on this page was gonna increase with time which meant the time for this stage of the test was bound to increase.

In my search for how to search for a single table using multiple attributes:

I found this:

After:

browser.table(:class => 'my_class_name', :text => /#{'some_text_1}/, :text => /#{'some_text_2}/)

Believe it or not, i got my test time reduced to 3secs, awesome isnt it?

Enjoy!!!!!!

Friday, 23 April 2010

Implement 'Select column_name from table_name where condition' in Active Record

I need an array from the data contained in a particular database column based on a condition, so i get the array of active record rows:

array_of_rows = TableName.find(:all, :conditions => {:column_name => ['col_data1','col_data2']})

Then use the array map! function to replace the active record objects with the column_name value
array_of_rows.map!{|item| item.column_name}

Doing some search got me:

array_of_rows = TableName .find(:all,:select=>'column_name' :conditions => {:column_name => ['col_data1','col_data2']}).map(&:column_name)

And i like this better, concise ....
update:

I've had to update the active record query above by removing the :select option

array_of_rows = TableName .find(:all, :conditions => {:column_name => ['col_data1','col_data2']}).map(&:column_name)

This is because if i have a method

def find_some_data
TableName .find(:all,:select=>'column_name' :conditions => {:column_name => ['col_data1','col_data2']})
end

I am able to do:

find_some_data.map(&:column_name)

but i cannot do

find_some_data.map(&:another_column_name)

throws: missing attribute: another_column_name (ActiveRecord::MissingAttributeError)

because i have only retrieved 'column_name' values from the table

In other to be able to create any array composed of data from any column_name, i have

def find_some_data
TableName .find(:all, :conditions => {:column_name => ['col_data1','col_data2']})
end

Tuesday, 6 April 2010

Active Record find by Column Name

In recent days been doing a lot of ruby, which means i tend to use Active Record as well.

I had written some scripts where i was selecting records that matched a criteria such as:

@table1.table2s.select{|e| e.column_name == 1234}

but as i need to sort my result and also give some more conditions to filter the data, i need alternatives to this above query and i ended up with the two lines of code below:

@table1.table2s.find(:all, :conditions => {:column_name => 1234})
@table1.table2s.find_all_by_column_name(1234)

Please note that the two lines above does same thing, the second one is just a lil but shorter and more readable the the 1st one.

using the second one i can now do stuff like

@table1.table2s.find_all_by_column_name(1234, :order => "col_2 ASC")

which would order my results based on the column that i have specified and i could have ASC - ascending and DESC - descending.

I have learnt something else today .... Have you?

Saturday, 27 March 2010

Fixing the annoying XP Antivirus 2009 OR 2010

This is not a post directly related to my blog but i am sure there are few people out there that might be facing same issues. In the last one week i had friends whose windows machines have been infected the XP Antivirus 2010, which seems to be a clone of XP Antivirus 2009. The symptoms include that you are get annoyings popups asking you to pay for an antivirus, i hope you have exposed yourself already.

There are so many ways to fix this problems.

The first one is a biased solution, which is ditch your windows machine and buy a macOsx or format your machine and install ubuntu. Well i guess that wouldnt be a popular option.

So i have an alternative:

1. Install Malwarebytes, it is quite a good tool to remove malware from your machine.
You would notice that it would detect quite a number of malware, make sure after the full scan, you remove all the infections detected.

You are also gonna notice that, .exe files would not work after you have deleted the threats discovered by Malwarebytes.

2. To fix .exe files not working, follow the steps described below.

Have the following text copied into a notepad :-

------Start --------Do not copy this line, copy starting next line ----------------

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.exe]
@="exefile"
"Content Type"="application/x-msdownload"

[HKEY_CLASSES_ROOT\.exe\PersistentHandler]
@="{098f2470-bae0-11cd-b579-08002b30bfeb}"

[HKEY_CLASSES_ROOT\exefile]
@="Application"
"EditFlags"=hex:38,07,00,00
"TileInfo"="prop:FileDescription;Company;FileVersion"
"InfoTip"="prop:FileDescription;Company;FileVersion;Create;Size"

[HKEY_CLASSES_ROOT\exefile\DefaultIcon]
@="%1"

[HKEY_CLASSES_ROOT\exefile\shell]

[HKEY_CLASSES_ROOT\exefile\shell\open]
"EditFlags"=hex:00,00,00,00

[HKEY_CLASSES_ROOT\exefile\shell\open\command]
@="\"%1\" %*"

[HKEY_CLASSES_ROOT\exefile\shell\runas]

[HKEY_CLASSES_ROOT\exefile\shell\runas\command]
@="\"%1\" %*"

[HKEY_CLASSES_ROOT\exefile\shellex]

[HKEY_CLASSES_ROOT\exefile\shellex\DropHandler]
@="{86C86720-42A0-1069-A2E8-08002B30309D}"

[HKEY_CLASSES_ROOT\exefile\shellex\PropertySheetHandlers]

[HKEY_CLASSES_ROOT\exefile\shellex\PropertySheetHandlers\PEAnalyser]
@="{09A63660-16F9-11d0-B1DF-004F56001CA7}"

[HKEY_CLASSES_ROOT\exefile\shellex\PropertySheetHandlers\PifProps]
@="{86F19A00-42A0-1069-A2E9-08002B30309D}"

[HKEY_CLASSES_ROOT\exefile\shellex\PropertySheetHandlers\ShimLayer Property Page]
@="{513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}"

-----------End--------------Do not copy this line. Copy till the end of previous line------------

Boot the computer in safe mode with networking

- Usually by tapping F8 when the computer boots up

Open My Computer, Click on tools and then folder options.

Select - "Show hidden files and folders"
- Uncheck "Hide protected operating system files"

Apply and then OK

For XP :-

5. Navigate to C:\Documents and Settings\%userprofile%\Local Settings\Application Data
Look for either of the following files :-

- av.exe
- msascui.exe

And delete these files .... Hopefully these should have been removed by the malwarebytes.

Now open the notepad file saved on your desktop earlier

Click on file-> save as

- Select file type as all files
- Name the file as fix.reg
- Encoding should be Unicode
Run that file, it will edit the registry accordingly

Now restart the computer in normal mode and everything should working fine.

Wednesday, 10 March 2010

Blank cells in step tables in cucumber 0.3.11 is represented as nil

In my current job, I have been doing a lot of acceptance test using Cucumber, Watir and RSpec, obvious all in Ruby. I have been using Cucumber 0.6.x, in which blank cells in the step table are represented by empty string (""). This was okay for me until today when i had to use a previous version of Cucumber 0.3.11 due to reasons including compatibility with other projects in the CI build. And my tests start failing because blank cells are represented as nil.

There was fix put in the current release of cucumber to change blanks to be represented as empty and not as nil(for whatever reason, which i don't really care, as both nil and "" has got its own arguments.)

Some code to explain this, Assuming i have a step table as below:

Given that i have the following detail in my app
|Header1|Header2|Header3|Header4|
|Body1 |Body2 |Body3 | |

Notice that the last column of the second row is blank, this would be represented as nil in cucumber 0.3.11 while it is represented as empty string "" in cucumber 0.6.x

In my step definition file, I have fixed this by converting every nil value to empty ("")

Given /have the following detail/ do |table|
table.rows.each do |row|
row.map! {|value| convert_nil_to_empty_string(value)}
# do some other stuff with row as every nil object has been converted to empty string
# The map! method for Array, allow you to invoke the block for the array and it amends
# the existing array
end
end

The method which i call to convert nil to empty is below:

def convert_nil_to_empty_string(test_string)
if (test_string.nil?)
return ""
else
return test_string
end
end

There might have been a better way to do this but this surely worked for me in this scenario and the reason i decided to use a method was that the map! method would only allow me use the variable "value" only once in the block. I am sure there are some rubyist out there, that could advice me on some shorthand for this ....... Hope it helps you too

Wednesday, 24 February 2010

selenium.open timeouts for strange reasons

Have you ever been in situations when your selenium RC test times out after the selenium.open command, the page is loaded but selenium just tells you that it has timed out after 30000ms.

I had same problem in Java today when i got the selenium RC 1.0.3 and i fixed the problem by setting the selenium timeout to be "0". so i have done

@BeforeClass
public void setUp(){
selenium = new DefaultSelenium("localHost", 4444, "*iexplore", url);
selenium.start();
selenium.setTimeout("0");
}

and then i have used a waitForPageToLoad in each of the selenium methods that needs to wait - open, click .....

selenium.open(url);
selenium.waitForPageToLoad("5000");

selenium.click("btnG");
selenium.waitForPageToLoad("5000");


Hopefully you find this useful.

Monday, 11 January 2010

Regex for pipe "|" character

I was trying to split a string using a regex today and i had this problem

my string of format

A | B | C

My intent was to split this string using the Regex match for "|"

The regex that worked for me was "\\|" - escaping pipe and then escaping the slash the escapes the pipe

Monday, 23 November 2009

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! on session 471c65508e46457fa43f4deb873d0592
Then i read in some issue raised in the flash selenium site that flash selenium would only work in firefox 3.0 and it worked fine in IE for me.

Today while i was investigating another issue, i decided to try running the flashSelenium test in the "*firefoxproxy" mode and my tests ran succcessfully.

I am sure this workaround would be welcome by people facing this issue as well, please leave a comment if this is any help.

Thanks




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.lang.RuntimeException: java.io.FileNotFoundException: C:\DOCUME~1\SAdesoga\LOCALS~1\Temp\customProfileDir688eff769c8b4751b5fb9477bba213f3\core\RemoteRunner.html (The system cannot find the file specified)
at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.createHTAFiles(HTABrowserLauncher.java:100)
at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.launch(HTABrowserLauncher.java:60)
at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.launchRemoteSession(HTABrowserLauncher.java:140)
at org.openqa.selenium.server.browserlaunchers.InternetExplorerLauncher.launchRemoteSession(InternetExplorerLauncher.java:77)
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:357)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:122)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:84)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:712)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:393)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:364)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:125)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
at org.mortbay.http.HttpServer.service(HttpServer.java:909)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: java.io.FileNotFoundException: C:\DOCUME~1\SAdesoga\LOCALS~1\Temp\customProfileDir688eff769c8b4751b5fb9477bba213f3\core\RemoteRunner.html (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(Unknown Source)
at org.apache.tools.ant.types.resources.FileResource.getInputStream(FileResource.java:185)
at org.apache.tools.ant.util.ResourceUtils.copyResource(ResourceUtils.java:372)
at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:475)
at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:438)
at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:404)
at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:379)
at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:317)
at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.createHTAFiles(HTABrowserLauncher.java:97)
... 19 more
This points out that selenium is trying to start in the iehta mode, even though i have specified that it start in iexplore mode. Doing i quick search i discovered that there has been some work to start up selenium in iehta even when iexplore is being specified. And the only way to get the original *iexplore is to try *iexploreproxy or piiexplore

So i changed my config file to start selenium using "*iexploreproxy" instead of "*iexplore" and voila i am able run my test on ie.

Hope this helps you too

Wednesday, 18 November 2009

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.matches();
System.out.println(b);

A quick run of this code printed "true" which means the code works.

So i wrote this:

Pattern p = Pattern.compile("[1,2,3,4]");
Matcher m = p.matcher("promo-area-3");
System.out.println(m.group());

and guess what this fails ...... giving me an "illegal state exception"

Pattern p = Pattern.compile("[1,2,3,4]");
Matcher m = p.matcher("promo-area-3");
boolean b = m.matches();
System.out.println(b);

This returns false which suggests that matching is not working properly.

After a lot of guesses and try and errors , i did

Pattern p = Pattern.compile("[1,2,3,4]");
Matcher m = p.matcher("promo-area-3");
while (m.find()) {
System.out.println("regex stuff " + m.group());
}

My thinking is this, the first code with this pattern "Pattern.compile("a*b");" was searching for a text which the subsequent one "Pattern.compile("[1,2,3,4]")" was a search for a character within a sequence and maybe this account for the while loop with m.find ........

Am not sure, maybe if anyone has a better explanation ... i would appreciate

Monday, 16 November 2009

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.

public class SeleniumManager {
private SeleniumServer seleniumServer;

private static Selenium selenium;

private RemoteControlConfiguration rcc;

@BeforeSuite
@Parameters( { "selenium.port" })
public void startSeleniumServer(String port) {

rcc = new RemoteControlConfiguration();
rcc.setPort(Integer.parseInt(port));

try {
seleniumServer = new SeleniumServer(false, rcc);
// seleniumServer= new SeleniumServer();
seleniumServer.start();

} catch (Exception e) {
throw new IllegalStateException("Can't start selenium server", e);
}
}

@AfterSuite(alwaysRun = true)
public void stopSeleniumServer() {
if (seleniumServer != null) {
seleniumServer.stop();
}
}

public static Selenium startSelenium(String host, String port, String browser, String url) {
selenium = new DefaultSelenium(host, Integer.parseInt(port), browser, url);
selenium.start();
return selenium;
}

public static void stopSelenium(Selenium selenium) {
selenium.stop();
}

}
As you can see i have a seleniumManager class which would dynamically start the selenium server before my testSuite starts and kill the SeleniumServer after the test suite is completed.

Please try this out and leave comments

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.stop();
}
}

i was setting the user extension file using the remoteControlConfiguration object

so i had typed:

rcc.setUserExtensions(new File({path_location_to_user_extension.js}));

This didnt work and an extensive search in the api wasnt very useful.
A colleague however found out that doing a

seleniumServer.boot(); would make the user-extension file to work.

Great isn't it ...........

Friday, 4 September 2009

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.

Preparing Firefox profile...

The source of the problem is in the *.rdf files inside the selenium server jar. The Selenium guys have hardcoded a version ceiling for Firefox at version 2.0.0.* (in my case it was 3.5.*). The fix is really simple.

Step 1: Extract the files needing change (from the directory where you have the jar). -

jar xf selenium-server.jar customProfileDirCUSTFFCHROME/
extensions/readystate@openqa.org/install.rdf
jar xf selenium-server.jar customProfileDirCUSTFFCHROME/
extensions/{538F0036-F358-4f84-A764-89FB437166B4}/install.rdf
jar xf selenium-server.jar customProfileDirCUSTFFCHROME/
extensions/\{503A0CD4-EDC8-489b-853B-19E0BAA8F0A4\}/install.rdf
jar xf selenium-server.jar customProfileDirCUSTFF/extensions/
readystate\@openqa.org/install.rdf
jar xf selenium-server.jar customProfileDirCUSTFF/extensions/
\{538F0036-F358-4f84-A764-89FB437166B4\}/install.rdf

Step 2: Change the max version in the rdf (Resource Description Framework) files.

The line of interest looks like this: 2.0.0.*

* you can change this to 4.*, should buy some time.

Step 3: Update the jar with your changes.

jar uf selenium-server.jar customProfileDirCUSTFFCHROME/
extensions/readystate@openqa.org/install.rdf
jar uf selenium-server.jar customProfileDirCUSTFFCHROME/
extensions/{538F0036-F358-4f84-A764-89FB437166B4}/install.rdf
jar uf selenium-server.jar customProfileDirCUSTFFCHROME/
extensions/\{503A0CD4-EDC8-489b-853B-19E0BAA8F0A4\}/install.rdf
jar uf selenium-server.jar customProfileDirCUSTFF/
extensions/readystate\@openqa.org/install.rdf
jar uf selenium-server.jar customProfileDirCUSTFF/
extensions/\{538F0036-F358-4f84-A764-89FB437166B4\}/install.rdf

That's it, once that's changed you should be good to go for testing against Firefox 3!

So that was a summary of what i found, but my case was a bit different as the version of firefox that was hardcoded in the selenium-server 1.0.1 was 3.5.* and my version of firefox was 3.5.2, so naturally i expected firefox to work for me. But as it did not work, as a trail and error, i changed the hardcoded version to 4.5.*. and voila it worked for me.

Also i did not use the jar uf command, what i did was to temporarily change the extension of the selenium server jar file to a .zip file and then i opened the zipped file created with winzip.

I then extracted the 5files which i need to amended to my desktop, amended the file with a text utility and then drop the files back into the zippped selenium server file. Lastly i changed the extensions back to .jar.

And it worked. i hope this works for someone as well

Monday, 13 July 2009

css selectors in place of xpath for selenium locators

yeah so in all these year, i have always resolved to using xpath whenever i am creating selenium scripts and i need to do stuff with element that have 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.

It takes some time to get used to but these are some link that might be useful to get start with ....

Enjoy .....

Thursday, 30 April 2009

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.

This is quite good as i have decided to run intraday tests in safari so as to get faster feedback, cos up until now i am unable to kick off these test because a test suite that takes 4hr 30min to executes would have taken almost half of my day and does little good.

I would be writing another post that talk about how to efficiently use Xpath in your tests whenever you need to ......


Any comments ............

Wednesday, 4 March 2009

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

Just incase the link goes down some day, here is what you need to do

1. Kill all services relating to Microsoft products (i.e. Word, Outlook, Messenger etc.)
2. Then from the Run line, enter "outlook.exe /cleanfreebusy".