Thursday, September 11, 2014

Invoking popup box with custom msg

Below is the single line vb script which invoked pop up box with custom msg.


I use this to notify me to have some water. Genarally we forget to have water at office. So Created a file with is line having msg saying "take some water". Now using crontab(linux)/schedule tax(windows). You can schedule say for every hour. So that you will get popup every hour reminds to have some water...

how to add task to scheduler. (wizards may varies but you can get idea)

Tuesday, September 9, 2014

Solution: IE webdriver not able to find web elements/ IE driver working very slow while providing input/sendkeys

IE webdriver not able to find web elements:-

From coding side web driver should be initiated as copied below.

DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
System.setProperty("", "C:\\IEDriverServer\\IEDriverServer.exe");
WebDriver IEDriver = new InternetExplorerDriver(ieCapabilities);
IEDriver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

If still it doesn't work in addition to above please look into below requirements (copied content from selenium site)

Required Configuration

  • The IEDriverServer exectuable must be downloaded and placed in your PATH.
  • On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".
  • Additionally, "Enhanced Protected Mode" must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog.
  • The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
  • For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor isHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.

Now web driver should work properly may be sendkey works very slow.

IE driver working very slow while providing input/sendkeys:-
Yeap, it may happen with 64 bit version of IE, try with 32 bit version of IE web driver it should work

Wednesday, October 23, 2013

using expect scripting in perl simple example

Small example is given below. I hope it is self explanatory.
use Expect;
my $command = 'ssh';
my $params = ("$Username\@$Server");
my $exp = new Expect;
# Create the Expect object
$exp->spawn($command, $params)
# Wait for Password prompt to show up
$exp->expect($timeout, ["Password:"]);
# Sent the ssh password
# Wait for command prompt of remote machine
$exp->expect($timeout, ["root\@localhost"]);

Friday, October 18, 2013

perl: Set fileName and line no in print

Here is small tip for those who want to print current file and line number. It helps when code spread across multiple files.

here is example :-

print "@{[ __FILE__ ]}:@{[ __LINE__ ]}: here goes your custom log \n";

---Enjoy debugging