Hi,
I have developed two scripts.
One using an headless htmunit and other using the browser, Firefox.
For the same code I have different results :/ the one using Firefox is working fine, the headless no.
### the headless script
capabilities = Selenium::WebDriver::Remote::Capabilities.htmlunit(
:browser_name => "htmlunit",
:javascript_enabled => true,
:css_selectors_enabled => true,
:takes_screenshot => true,
:native_events => false,
:rotatable => false,
:firefox_profile => nil,
:proxy => nil)
driver = Selenium::WebDriver.for(:remote,
:url => "http://127.0.0.1:4444/wd/hub",
:desired_capabilities => capabilities)# -- (same code as 'the firefox one')
### the Firefox one
require "selenium-webdriver"
driver = Selenium::WebDriver.for :firefox
driver.navigate.to "http://someurl/login.php"
element = driver.find_element(:name, 'tfUsername')
element.send_keys "admin"
element = driver.find_element(:name, 'tfPassword')
element.send_keys "passwordgoeshere"
element.submit
driver.navigate.to "http://someurl/admin/hostgroups.php"
element = driver.find_element(:name, 'subAdd').click
element = driver.find_element(:name, 'tfName')
element.send_keys "AAAAAA"
element = driver.find_element(:name, 'tfFriendly')
element.send_keys "BBBBBB"
driver.save_screenshot("screenshot.png")
element = driver.find_element(:name, 'subForm').click
The thing is when I run the headless code I get a subAdd element not found. Any tip? I think I am starting a htmlunit 'browser' correctly with the 'same' and 'default' features as a 'default' browser.
I'm using 2.5.0 but with 2.9.0 I have the same problem.
The output is:
org.openqa.selenium.NoSuchElementException: Unable to locate element with name: subAdd
Any tip to?
Thanks in advance.
Francisco