0

I've to run Selenium test on IE 10 browser. In order to run following script, I did following:

  1. Downloaded IEDriverServer(64 bit since my machine is 64 bit) from here
  2. Put that (.exe) file in 'C://drivers' folder
  3. Set path 'C://drivers' in environment variables
  4. Run script

    require 'selenium-webdriver'    
    driver = Selenium::WebDriver.for :ie
    
    driver.get "http://www.google.com"
    
    button = driver.find_element(:id, "gbqfba")
    puts button.text
    driver.quit
    

Running aboe script result into following error:

c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/response.rb:51:in `assert_ok': Unable to find element with id == gbq
fba (Selenium::WebDriver::Error::NoSuchElementError)
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/default.rb:66:in `request'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:629:in `raw_execute'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:607:in `execute'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:575:in `find_element_by'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/common/search_context.rb:42:in `find_element'
        from ie.rb:7:in `<main>'

Same script runs fine with Chrome and Firefox browser. Please help me to understand where I'm doing wrong.

LaurentG
  • 11,128
  • 9
  • 51
  • 66
Alpha
  • 13,320
  • 27
  • 96
  • 163

3 Answers3

1

Bit of hunch here, but have you followed this;

On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".

Robbie Wareham
  • 3,380
  • 1
  • 20
  • 38
  • Thanks RobbieWareham, for helping! But I didn't understand the logic. I'll find it. Thanks again! – Alpha Aug 28 '13 at 13:53
  • You can also find the reasons behind this requirement fully explained in [this blog post](http://jimevansmusic.blogspot.com/2012/08/youre-doing-it-wrong-protected-mode-and.html) – JimEvans Aug 29 '13 at 13:02
1

Required Configuration

  1. The IEDriverServer exectuable must be downloaded and placed in your PATH.

  2. On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".

  3. The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.

For more info go to http://code.google.com/p/selenium/wiki/InternetExplorerDriver

Abhishek Singh
  • 10,243
  • 22
  • 74
  • 108
  • Thanks Abhishek for helping and most importantally for pointing to doc! Upvoted the answer :) – Alpha Aug 28 '13 at 13:55
1
  • Download IEDriverserver
  • Extract the zipped folders and add them in Environment Variables path.

    My Computer > (right click) properties > Advanced system settings > Environment Variables

  • Click path under system variables and choose Edit.
  • Paste the Driver location.

enter image description here

@driver = Selenium::WebDriver.for :ie

or|

@driver = Selenium::WebDriver.for :internet_explorer

Prashanth Sams
  • 19,677
  • 20
  • 102
  • 125
  • 1
    Make sure to restart the machine after making the changes to PATH. It didn't work for me until I restarted. – Nora Jul 13 '15 at 15:00