Showing posts with label mac. Show all posts
Showing posts with label mac. Show all posts

Saturday, July 9, 2011

Sikuli on Selenium- A demonstration of automation using selenium and Sikuli (such as flash uploader)

Selenium 2.0 is just launched, and the excitement remind me that there are tons of selenium related things I need to share with the world.

One of those things is File Upload. File uploads have always been a real pain to automate using selenium.
People have used AutoIt (so have I) to upload on windows only environment. On windows, beside AutoIt, native events  (of webdriver) have worked a great deal for me in the past. 

It becomes a real challenge  when file upload is done via some flash components (components which don't provides hooks from java script to play with files to upload).  

I had tired couple of things but the thing which worked really well was to have type="file"  and send keys but flash uploader and *nix remains challenging.  

Then I stumble across Sikuli. From there web site "Sikuli is a visual technology to automate and test graphical user interfaces (GUI) using images (screenshots)".

Below is what I have done to use it to automat file upload via flash components on MacOS X. With few image changes we should be able to port it for Linux.


Source code is available at: https://github.com/mubbashir/Sikuli-on-Selenium

See it pretty smoothly uploads the file, but .. It works like a real user and real human user i.e. a real user can only interact with what is being displayed on the Screen. If the browser window dosen't have the focus Sikuli will not be able to find images.

Did I mention that test are written using TestNG, so this can slightly work as demonstration of TestNG on Selenium as well. 

Note: I haven't tried this in head-less mode.

Monday, September 27, 2010

Disk Usage on a Remote host: Enable X11 Forwarding for ssh and run x11 application

Lately I was in the of analyze analyze disk space on a remote server, when you are on *nix you can do such things quite easliy.
ssh into your remote host and Enable ForwardX11
  1. For  enabling it for sshd (ssh deamon):
    •   sudo vi /etc/ssh/sshd_config 
    • and modify X11Forwarding no to X11Forwarding yes
  2. Restart sshd:
    • sudo /etc/init.d/ssh 
  3. Exit from current session
  4. ssh into remote host again with -X flag
    • ssh -X username@hostname
  5. Run your application in my case $ baobab
Disk Usage Utility
Have Look at JDiskReport for a cross platform app.
For Macs Edit  sshd_config  located in /etc
  1. sudo vim /etc/sshd_config 
  2. ssh to your mac
  3. Run the app $ java -jar jdiskreport-1.3.2.jar 
JDiskReport