I'm new to automation, sorry if the title is not appropiate.
I have Ruby, Devkit, gem json, cucumber, capybara, selenium-webdriver, rspec installed following the guide http://www.swtestacademy.com/ruby-cucumber-and-capybara-on-windows/
However I cannot locate an element using a full xpath (checked and verified with xpath plugin and developer tool), my action is:
page.find(:xpath, "my_xpath").send_keys(yyy)
and I got: Unable to find visible xpath
I also tried:
page.findElement(By.xpath("my_xpath")).send_keys("ori_pw")
and I got: uninitialized constant By (NameError)
And I would like to try using watir, I have installed gem watir, watir-webdriver. and added require 'watir' into my env.rb then I try:
page.input(:name => "xxx").set(yyy)
But I get: undefined method `input' for # (NoMethodError)
May I have some suggestions please? Thanks.
=============================================Edit#1
My env.rb now looks like this:
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
require 'rspec'
require "selenium-webdriver"
require 'watir'
require 'cucumber'
Selenium::WebDriver::Firefox::Binary.path='C:\Program Files\Mozilla Firefox\firefox.exe'
Capybara.run_server = false
#Set default driver as Selenium
Capybara.default_driver = :selenium
#Set default selector as css
Capybara.default_selector = :cs
#Syncronization related settings
module Helpers
def without_resynchronize
page.driver.options[:resynchronize] = false
yield
page.driver.options[:resynchronize] = true
end
end
World(Capybara::DSL, Helpers)
How can I disable capybara and set watir properly? Sorry that I have no technical background...
Thomas, Yes the element is visible, HTML screenshot Actually I will be setting value to these 3 password fields. The xpath I'm trying is:
/html/body[@class='modal-open']/app-root/div[@id='wrapper']/app-navigation/user-change-password/div[@id='myModal']/div[@class='modal-dialog modal-lg']/div[@class='modal-content']/div[@class='modal-body']/form[@class='ng-pristine ng-invalid ng-touched']/fieldset[@class='form-horizontal']/div[@class='form-group'][1]/div[@class='col-sm-7']/input[1]
(at the end I use avoid using class as I see the class name different sometimes) Thanks. =============================================Edit#2
The problem now shift to chromedriver. Double clicking it able to show
Starting ChromeDriver 2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f) on port 9515
Only local connections are allowed.
But enter chromedriver on cmd will show Chromedriver.exe has stopped working.