Thursday, November 18, 2010

Specifying firefox path in selenium

Selenium sometimes throw the error saying it cannot open firefox and asks the user to set the path.
Please add the directory containing ''firefox.exe'' to your PATH environment
variable
, or explicitly specify a path to Firefox 3 like this:
*firefox3c:\blah\firefox.exe
I tried setting the path of firefox in the environment variable PATH but somehow it didn't work. So here is how to explictly specify it

@selenium = Selenium::Client::Driver.new \
:host => "localhost",
:port => 4444,
:browser => "*firefox C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe",
:url => "http://abc.com"

This solved the issue and opened firefox.

There was another issue of firefox opening in a small window during a test run and I wanted it to open a maximized size. In ruby this is how I solved this :-

In setup section after opening browser session, say window_maximize

@selenium.start_new_browser_session
@selenium.window_maximize

Tuesday, September 7, 2010

Change domain name in mail command for Unix

I was using mail command to send mail from the command line. However, my from address was coming as username@hostname and my mail server was not accepting this mail. I searched google for solutions but none worked for me. So atlast this is what I did.

1. Installed sendmail using "sudo apt-get install sendmail"
2. Install mailutils - "sudo apt-get install mailutils"
2. sudo vim /etc/mail/sendmail.mc
3. Changed the parameter "MASQUERADE_AS"

MASQUERADE_AS(`mydomain.com')dnl

4. Run "sudo sendmailconfig"
5. Now sent mail using
echo "this is mail body" | mail -s "this is test " sabu@mydomain.com

My last few lines of sendmail.c looks like :-

include(`/etc/mail/m4/dialup.m4')dnl
include(`/etc/mail/m4/provider.m4')dnl
dnl #
dnl # Default Mailer setup
dnl # Masquerading options
FEATURE(`always_add_domain')dnl
MASQUERADE_AS(`mydomain.com')dnl
FEATURE(`allmasquerade')dnl
FEATURE(`masquerade_envelope')dnl
MAILER_DEFINITIONS
MAILER(`local')dnl
MAILER(`smtp')dnl

Sendmail installation issue

While installing sendmail, I was thrown the following error :-

*** ERROR: FEATURE() should be before MAILER()
*** MAILER(`local') must appear after FEATURE(`always_add_domain')*** ERROR: FEA TURE() should be before MAILER()
*** MAILER(`local') must appear after FEATURE(`allmasquerade')*** ERROR: FEATURE () should be before MAILER()
NONE:0: m4: ERROR: EOF in string

I searched google only to find people suggesting to install postfix instead of sendmail. Now thats not what I want to do. I want to fix the above issue. Here is how I did it :-
sudo vim /etc/mail/sendmail.mc
Search and move the following lines to end of the file :-

MAILER_DEFINITIONS
MAILER(`local')dnl
MAILER(`smtp')dnl

And now it works.

Friday, August 27, 2010

On to Python

I am now on to Python, after tcl, after Ruby, after Perl. My progress is quick since I know Perl and Ruby. It doesn't matter if you don't know the syntax if you have experience in say Ruby or Perl.

Friday, April 9, 2010

Troubleshoot vmotion in VMWare

Here are some commands that help in troubleshooting vmotion in vmware :-

esxcfg-vmknic -l ( Gives a list of all VMKernel nics on your esx host)
vmkping (Used to ping your vmk interfaces)