Skip to main content

Posts

Showing posts with the label webdriver

Running Capybara Under Chrome, Poltergeist or Firefox

As a default Capybara runs under Firefox but if you want to change your driver you have to change your javascript driver to your new driver. But you also must define your driver as registered Capybara driver. For example if you want to run with Chrome and change your driver to chrome but not define it, it gives some errors like following irb(main):007:0> visit "http://www.amazon.com" Capybara::DriverNotFoundError: no driver called :chrome was found, available drivers: :rack_test, :selenium, :poltergeist from /Library/Ruby/Gems/2.0.0/gems/capybara-2.4.1/lib/capybara/session.rb:77:in `driver' from /Library/Ruby/Gems/2.0.0/gems/capybara-2.4.1/lib/capybara/session.rb:226:in `visit' from /Library/Ruby/Gems/2.0.0/gems/capybara-2.4.1/lib/capybara/dsl.rb:51:in `block (2 levels) in ' if you add the following line into your env.rb module, you will successfully run under Chrome driver. Capybara.register_driver :chrome do |app| Capybara::Selenium::Driver

Selenium Error "Element is not currently interactable and may not be manipulated"

Selenium webdriver can drive different browsers like as Firefox, Chrome or Internet Explorer. These browsers actually cover the majority of internet users, so testing these browsers possibly covers the 90% of the internet users. However, there is no guaranty that the same automation scripts can work without a failure on these three browsers. For this reason, automation code should be error-prone for the browsers you want to cover. The following error is caught when the test script run for Chrome and Internet Explorer, but surprisingly there is no error for the Firefox. Selenium gives an error like below: Traceback (most recent call last):   File "D:\workspace\sample_project\sample_run.py", line 10, in <module>     m.login()   File "D:\workspace\ sample_project \test_case_imps.py", line 335, in login     driver.find_element_by_id("id_username").clear()   File "C:\Python27\lib\site-packages\selenium-2.35.0-py2.7.egg\selenium\webdriver\r

How to Update Selenium Webdriver for Windows

As I tried to explain in my previous posts Selenium is an automation framework for web application and Webdriver is the newer version of Selenium RC. I have used Selenium Webdriver for automatizing web application with version of selenium-2.25.0-py2.7.egg which prepared for the Python. However there are newer version this Webdriver package.In this post I explain how to update Webdriver version on Windows. If you check the site-packages folder where the Webdriver installation folders are present, you can see the related folder. In this folder there is easy_install.py which is used upgrading. If you can't find this file first you need you install setuptool . To update the Selenium version, you can follow the instruction below: Check easy_install file in the directory like as C:\Python27\Lib\site-packages if there is easy_install go to next step, if you don't have it install setuptools from here. Download Selenium newer version from here . Select the link what language

Selenium Error Message: "Can't load the profile. Profile Dir:..."

Because of an upgrade, I needed to move to new computer and new operation system so I moved my automation code to new system which is from Window 7 to Windows 8. When run the code I got the following error indicating that the Selenium can't load the profile which means that the version of the browser is not supported by the Selenium yet. If you get an error like the following one, you need to find the supported version of the browsers. Traceback (most recent call last):   File "D:\workspace\ automation_project \run_test_cases.py", line 12 4, in <module>     m = Markafoni(browser, server)   File "D:\workspace\ automation_project \test_case.py", line 8 64, in __init__     self.driver = webdriver.Firefox()   File "C:\Python27\lib\site-packages\selenium-2.25.0-py2.7.egg\selenium\webdriver\firefox\webdriver.py", line 51, in __init__     self.binary, timeout),   File "C:\Python27\lib\site-packages\selenium-2.25.0-py2.7.egg\sele

Internet Explorer Launching Gives Errors in Selenium Webdriver

As selenium user know, Selenium script can be run via FireFox, Chrome and Internet Explorer if you set up the environments correctly, you may read this post if you are un-sure. If you face an error while launching Internet explorer in selenium test automation, you need to set all the security zone in the same mode (enabled, or disabled mode). If you change security zone, selenium gives the following errors, and the last one says " Protected Mode settings are not the same for all zones " so you can set the protected mode by Tool > Internet Options > Security Tab then set Internet, Local Internet, Trusted Sites, and Restricted Sites as same mode, enabled or disabled. Then click "Apply" and "OK" and repeat your tests. File "C:\Python27\lib\site-packages\selenium-2.25.0-py2.7.egg\selenium\webdriver\ie\webdriver.py", line 53, in __init__     desired_capabilities=DesiredCapabilities.INTERNETEXPLORER)   File "C:\Python27\lib\site-packa

Selenium Assertion Check Fails if There are More Than Four Assertions

As you know that selenium is a open source test automation framework for web application. Since it has many good features and being free make it usable for anyone develops or tests web application. However, if we compare it with well-known, highly cost licensed product selenium has some disadvantages such as, as far as I used it may be the main problem, there is no guaranty if the automation scripts works all the time. Even it works for a run successfully, it may give error after a few seconds of it first run. Therefore to fully utilize it, the drawbacks of  the selenium should be known and the scripts should be redesigned. In this post, I want to explain a selenium experiment about assertion. Last time I have faced an error related assertion check during automating a new form. Error is related to a error message which can not be found by webdriver and it waits for a trigger to next step. However if I run every assertion one by one there is no error and it finished successfully. E

Integration of Two open Source Test Automaiton Tools: Watir and Selenium

Selenium and Watir Selenium and Watir are both open source and well-known automation tools. The power of Selenium is great but sometimes it may lead some insufficient result for executing test cases, or some difficulties can be achieved by Watir easily, surely or wise verse. Therefore we can use Selenium and Watir together for automating web applications. In this post, I want to show a sample to illustrate how to use both of them in the same automation framework. Possibly you maybe find something more accurate than what I did, fell free to post your thoughts. I have used Selenium with Pyhton as a base automation framework and call Watir in Ruby which Watir can be just only implemented by it. If you use another language than Python, you should use its features. In the sample, sign up for MYHABIT is implemented as Watir function in the name sign_up() and it is called by Selenium.  To call the Watir, Python module must import Popen, PIPE, STDOUT from Subprocess like as f

Using Selenium Webdriver via Internet Explorer (ie) and Chrome

As it is known Selenium IDE is an extention for Firefox browser. And the Webdriver is an application to send commands to firefox to drive it. As a default set-up, firefox comes with it for running automated test cases. However, sometimes running compatibiliy related test cases via, especially, Internet Explorer but Chrome may be needed. If you want to run your test cases via other browsers you need to do some configuration changes in your test environment. Download the webdriver of browsers for selenium web site: For Internet Explorer click here and dowload  IEDriverServer 32bit or 64bit depending on your system For Google Chrome, dowload Chronium webdriver click here   and dowload chromedriver_win Put the webdrivers to your path wich your executable files are present. It is generally like this C:\Windows\System32    You need to allow IE Driver and Chrome Driver to access your network: Allow Access to IE Driver and Chrome Driver Finally call the drivers you want to use