Discussion:
[wtr-general] Re: Success with headless browser on Windows/JRuby/watir-webdriver
江南
2017-12-15 14:42:23 UTC
Permalink
Hi,

I have tried your code above but I'm getting this error message:

NameError: uninitialized constant WebDriver

I'm using Window.
http://watirmelon.com/2010/12/14/watir-webdriver-a-detailed-introduction/
I grabbed the selenium-server-standalone jar and put in my app folder
# This is working on Windows/JRuby!
require "rubygems"
require "bundler/setup"
require "watir-webdriver"
require 'selenium/server'
server = Selenium::Server.new("selenium-server-
standalone-2.0b1.jar", :background => true)
server.start
include Selenium
capabilities =
WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled => true)
b = Watir::Browser.new(:remote, :url => 'http://127.0.0.1:4444/wd/
hub', :desired_capabilities => capabilities)
# Browser fun here
b.close
server.stop
--
--
Before posting, please read http://watir.com/support. In short: search before you ask, be nice.

watir-***@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+***@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
江南
2017-12-15 15:19:09 UTC
Permalink
Hi,

I got it to work according to your code but I am getting this error message
when my script try to click on a button:

Selenium::WebDriver::Error::UnknownError: java.lang.String cannot be cast
to net.sourceforge.htmlunit.corejs.javascript.Function
(java.lang.ClassCastException)

Are there ways to resolve my issue?
http://watirmelon.com/2010/12/14/watir-webdriver-a-detailed-introduction/
I grabbed the selenium-server-standalone jar and put in my app folder
# This is working on Windows/JRuby!
require "rubygems"
require "bundler/setup"
require "watir-webdriver"
require 'selenium/server'
server = Selenium::Server.new("selenium-server-
standalone-2.0b1.jar", :background => true)
server.start
include Selenium
capabilities =
WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled => true)
b = Watir::Browser.new(:remote, :url => 'http://127.0.0.1:4444/wd/
hub', :desired_capabilities => capabilities)
# Browser fun here
b.close
server.stop
--
--
Before posting, please read http://watir.com/support. In short: search before you ask, be nice.

watir-***@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+***@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Titus Fortner
2017-12-15 17:38:20 UTC
Permalink
This is a very old post. watir-webdriver is deprecated in favor of the
latest version of Watir. Our introduction guides are
here: http://watir.com/guides/

Let us know if you are continuing to have difficulties.
Post by 江南
Hi,
I got it to work according to your code but I am getting this error
Selenium::WebDriver::Error::UnknownError: java.lang.String cannot be cast
to net.sourceforge.htmlunit.corejs.javascript.Function
(java.lang.ClassCastException)
Are there ways to resolve my issue?
http://watirmelon.com/2010/12/14/watir-webdriver-a-detailed-introduction/
I grabbed the selenium-server-standalone jar and put in my app folder
# This is working on Windows/JRuby!
require "rubygems"
require "bundler/setup"
require "watir-webdriver"
require 'selenium/server'
server = Selenium::Server.new("selenium-server-
standalone-2.0b1.jar", :background => true)
server.start
include Selenium
capabilities =
WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled => true)
b = Watir::Browser.new(:remote, :url => 'http://127.0.0.1:4444/wd/
hub', :desired_capabilities => capabilities)
# Browser fun here
b.close
server.stop
--
--
Before posting, please read http://watir.com/support. In short: search before you ask, be nice.

watir-***@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+***@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
江南
2017-12-19 10:49:45 UTC
Permalink
Hi,

I am using watir the latest version but I'm still getting the error I
mentioned in my previous post. Is there a way to resolve it?

I have tried different headless driver like Chrome but when I run this
code: @browser = Watir::Browser.new :chrome, headless: true
I'm getting this error message: Net::ReadTimeout: Net::ReadTimeout
Post by Titus Fortner
This is a very old post. watir-webdriver is deprecated in favor of the
http://watir.com/guides/
Let us know if you are continuing to have difficulties.
Post by 江南
Hi,
I got it to work according to your code but I am getting this error
Selenium::WebDriver::Error::UnknownError: java.lang.String cannot be cast
to net.sourceforge.htmlunit.corejs.javascript.Function
(java.lang.ClassCastException)
Are there ways to resolve my issue?
http://watirmelon.com/2010/12/14/watir-webdriver-a-detailed-introduction/
I grabbed the selenium-server-standalone jar and put in my app folder
# This is working on Windows/JRuby!
require "rubygems"
require "bundler/setup"
require "watir-webdriver"
require 'selenium/server'
server = Selenium::Server.new("selenium-server-
standalone-2.0b1.jar", :background => true)
server.start
include Selenium
capabilities =
WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled => true)
b = Watir::Browser.new(:remote, :url => 'http://127.0.0.1:4444/wd/
hub', :desired_capabilities => capabilities)
# Browser fun here
b.close
server.stop
--
--
Before posting, please read http://watir.com/support. In short: search before you ask, be nice.

watir-***@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+***@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...