1

I used Selenium IDE to record some actions on a webpage, reply on firefox works fine if I slow down the run. Once I exported it as a python 2 script, run with chrome then it fails.

Here is the section of the script:

    def test_add_data(self):
    driver = self.driver
    driver.get(self.base_url + "/login")
    driver.find_element_by_id("login_user").clear()
    driver.find_element_by_id("login_user").send_keys("<masked>")
    driver.find_element_by_id("login_pass").clear()
    driver.find_element_by_id("login_pass").send_keys("<masked>")
    driver.find_element_by_id("button-log-in").click()
    driver.find_element_by_link_text("Devices").click()
    driver.find_element_by_link_text("Test Device 01").click()
    driver.find_element_by_link_text("wind speed").click()
    driver.find_element_by_id("addTag").click()
    driver.find_element_by_id("txtwritedatavalue").clear()
    driver.find_element_by_id("txtwritedatavalue").send_keys("7")
    driver.find_element_by_id("button-data-write").click()
    driver.find_element_by_id("addTag").click()
    driver.find_element_by_css_selector("span.popupclose > img").click()
    driver.find_element_by_link_text("Home").click()
    driver.find_element_by_css_selector("a.nav-switch > span").click()
    driver.find_element_by_link_text("Log-out").click()
    driver.find_element_by_id("login_user").clear()
    driver.find_element_by_id("login_user").send_keys("randy_lei@yahoo.ca")
    driver.find_element_by_id("login_pass").clear()
    driver.find_element_by_id("login_pass").send_keys("Exo1sit*emphasized text*e")

Here is the output from running the script,

Traceback (most recent call last):
File "add_data3.py", line 29, in test_add_data
driver.find_element_by_id("addTag").click()
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 74, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 457, in _execute
return self._parent.execute(command, params)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 233, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
ElementNotVisibleException: Message: Element is not currently visible and so may not be interacted with
Stacktrace:
at fxdriver.preconditions.visible (file:///c:/users/randy/appdata/local/temp/tmprickq_/extensions/fxdriver@googlecode.com/components/command-processor.js:10092)
at DelayedCommand.prototype.checkPreconditions_ (file:///c:/users/randy/appdata/local/temp/tmprickq_/extensions/fxdriver@googlecode.com/components/command-processor.js:12644)
at DelayedCommand.prototype.executeInternal_/h (file:///c:/users/randy/appdata/local/temp/tmprickq_/extensions/fxdriver@googlecode.com/components/command-processor.js:12661)
at fxdriver.Timer.prototype.setTimeout/<.notify (file:///c:/users/randy/appdata/local/temp/tmprickq_/extensions/fxdriver@googlecode.com/components/command-processor.js:625)

A script from a simpler recording on the same page works just fine. I added a waitForVisible(id=addTagg) before the complained line and it timed out and the script still failed the same way. Any way around this?

This is the first time I try selenium IDE recording scripts, is it in general this unreliable?

  • can you add the HTML of the element (and some surrounding code) you are looking for? – ECiurleo Mar 24 '16 at 11:43
  • Yes, need to see HTML in order to help you – Michael Durrant Mar 24 '16 at 12:45
  • I should've looked at the HTML code more carefully before. The addTag element is nowhere near what I needed to click. So I removed the two lines with addTag and all is good. Thanks all. I guess it was an unnecessary click that got recorded. – Randy Lei Mar 25 '16 at 1:25
1

This was my first time using selenium IDE, recorded the scenarios, saved as python scripts and run with a different browser.

It turned out to be an unnecessary action recorded, and removing the two addTag lines then all was good on firefox and chrome.

Just wanted to answer my own question hoping to be helpful for newcomers to selenium IDE of this possibility (of unnecessary action recorded).

0

The IDE is good for rapid prototyping but you'll want to make the move to Webdriver in your preferred language as soon as you hit problems.

Once you're up and running you're really not any slower then on the IDE and have more tools to do exactly what you want.

  • 1
    Thank you for your comment. I do use IDE as well as using webdriver directly with Robot Framework. Actually the IDE is a good way to learn the webdriver since you can export the script in webdriver flavour. I am still new in this, so I just wanted to explore their usability to aid our QA process. – Randy Lei Mar 26 '16 at 10:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.