Interaction At a Glance

Figure 1: Interaction Overview

While most methods are straightforward, some words on usage of Actions:
Actions:
is the user-facing API for emulating complex user gestures. A simple example of using Actions for Keyboard and Mouse Events:

//hover mouse over … Read the rest

Upload/Download Files

Selenium cannot interact with OS native dialog boxes, such as printing, file upload/download. To automate this, you can use:

  • The Robot class, it allows you to “press” programatically anything on the keyboard (or clicking blindly) and therefore getting rid of
Read the rest

Launch Browser with User Profile

What is User Profile
User profile stores your browser settings, bookmarks, extensions, apps, and saved passwords. This profile is stored in a separate folder on your computer, so if anything goes wrong with Chrome, your information is saved.

The location … Read the rest

Non-blocking Page Loading

By default WebDriver blocks till page is fully loaded when driver.get(URL) is executed. Most time this is what we desired but sometimes we want to change this behavior:

  • We just want to check something on the page, without waiting for
Read the rest

Fancy Clicks

Right click
To select the item from the menu after right click, just move your mouse positions with the use of Key down event like this:

Actions action= new Actions(driver);
action.contextClick(productLink).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.RETURN).build().perform();

Click on several keys at the same time

//Press … Read the rest

Babysitting IE Browser

You won’t be able to launch IE browser unless all the following 3 conditions are satisfied:

  • Browser’s zoom level needs to set as 100%
    Otherwise IE driver can’t calculate the coordinates to click on properly.
  • Protected Mode must be set
Read the rest

Why is IE so Difficult?

IE is so notorious with web automation that many people advocate ‘just forget about IE’ for web automation. Code that runs perfectly fine with chrome and Firefox would fail with IE. Why the hack is IE so difficult? Here are … Read the rest

Load the Page

After a browser is launched, then time to go get our web page.

GET
We can load our web page via get() method:

driver.get(“http://www.automediator.com”);

Loading page via GET is BLOCKING
driver.get() will load the page and wait until the page … Read the rest

Disable firefox automatic safe mode

By default, selenium webdriver launches firefox in safe mode if you instantiate driver like this:

FirefoxDriver driver = new FirefoxDriver();

Firefox will turns off hardware acceleration, resets some settings, and disables add-ons (extensions and themes) that might be causing problems.… Read the rest