47 : Do
you have faced any technical challenges with Selenium WebDriver test
automation?
Answer : Yes, I have faced bellow given technical challenges
during selenium webdriver test cases development and running.
·
Sometimes (Not always), Some elements like text box, buttons
etc. are taking more time(more than given Implicit wait time) to appear on page
or to get enabled on page. In such situation, If I have used only Implicit wait
then my test case can run fine on first run but It may fail to find element on
second run. So we need provide special treatment for such elements so that
webdriver script wait for element to be present or get enabled on page during
test execution. We can use Explicit wait to handle this situation. You can find
different explicit wait example links on THIS PAGE.
·
Handling dynamic changing ID to locate element Is tricky. If
element's ID Is changing every time when you reload the page and you have to
use that ID In XPath to locate element then you have to use functions
like starts-with(@id,'post-body-') or contains(@id,'post-body-') In
XPath. Other alternate solutions to handle this situation are described in
answer of Question 15 of THIS PAGE.
·
Clicking on sub menus which are getting rendered on mouse hover
of main menu Is some what tricky. You need to use webdriver's Actions class to
perform mouse hover operation. You can VIEW FULL EXAMPLE on how to generate mouse hover event on main menu.
·
If you have to execute your test cases In multiple browsers then
one test case can run successfully In Firefox browser but same test case may
fail In IE browser due to the timing related Issues (nosuchelement exception)
because test execution In Firefox browser Is faster than IE browser. You can
resolve this Issue by Increasing Implicit wait time when you run your test In
IE browser.
·
Above Issue can arise due to the unsupported XPath In IE
browser. In this case, You need to you OTHER ELEMENT LOCATING METHODS (ID, Name,
CSSSelector etc.)to locate element.
·
Handling JQuery elements like moving pricing slider, date
picker, drag and drop etc.. Is tricky. You should have knowledge of webdriver's
Advanced User Interactions API to perform all these actions. You can find few
example links for working with JQuery Items on THIS PAGE.
·
Working with multiple Windows, Frames, and some tasks like Extracting data from web table, Extracting data from dynamic web table, Extracting all Links from page, Extracting all text box from page are also tricky and
time consuming during test case preparation.
·
There Is not any direct command to upload or download files from
web page using selenium webdriver. For downloading files usign selenium
webdriver, You need to create and set Firefox browser profile with webdriver
test case. You can VIEW PRACTICAL EXAMPLE.
·
Webdriver do not have any built In object repository facility.
You can do It using java .properties file to create object repository as
described In THIS EXAMPLE.
·
Webdriver do not have any built In framework or facility using
which we can achieve bellow given tasks directly : 1. Capturing screenshots, 2.
generating test execution log, 3. reading data from files, 4. Generating test
result reports, Manage test case execution sequence. To achieve all these
tasks, We have to use external services with webdriver like Log4J to generate
log, Apache POI API to read data from excel files, Testng XSLT reports to
generate test result reports. TestNG to manage test case execution, .properties
file to create object repository. All these tasks are very time consuming. ON THIS PAGE, I have described how to create data driven framework step by
step for selenium webdriver. That framework contains all above functionality.
You can share other webdriver technical challenges which you
have faced by commenting bellow so that your experience can help to others
too.
No comments:
Post a Comment