Currently Browsing

Posts Tagged ‘ javascript ’

Read out browser console logs in java with selenium 2.53.1

Sometimes the usual test log and screenshot is not enough to find the reason of the failed test case. Especially when the test case occasionally fails in special circumstances and it is really hard to reproduce. For this reason, we need to collect for each fail as much information as possible. One possible source of information is the console output of the browser.

Some thoughts about the infamous StaleElementReferenceException

With the widespread of JavaScript we more and more met with one of our favourite exception which is the StaleElementReferenceException.
It can be tricky because it does not have to appear on the test development machine. This issue can hide in the test code and appear in unexpected situations.

The exception happens when the dom changes and the system can’t be sure if the Webelement is still on the page.
Dom changes can be caused by page refresh, javascript effects, ajax responses and so on.

Navigating between browser windows with WD

Hello,
I’ll continue more about testing with JavaScript WD test frame and Selenium stand-alone server.
Today’s topic is navigating between browser windows (or tabs) with WD.

The Webdriver sees each tab and window as a window, it doesn’t make difference. The difference is only at the browser how it is set to handle the windows appearance, opens them in separate browser or as tabs. With WD the navigation is pretty straight forward and not so difficult. There is a command called windowHandles() which as you can read handles the windows. Actually it returns a list of opened windows based on a generated ID by the browser. I’ll give some minor example about navigating and work between two windows.