How to install Firewatir - watir

I tried to install firewatir, and got the following error. I would be grateful for assistance.
C:\>gem install firewatir
Successfully installed firewatir-1.9.4
option --accessor is deprecated: support discontinued
file 'def_wrap=R,def_wrap_guard=R,def_creator=R,def_creator_with_default=R' not found
Installing ri documentation for firewatir-1.9.4
1 gem installed

Firewatir has been deprecated. You should use watir-webdriver instead, which can control chrome, firefox and others.
To install:
gem install watir-webdriver
To use:
require 'watir-webdriver'
browser = Watir::Browser.new :firefox # Will open a firefox browser
Note that if you use the watir gem, it supports both IE (using watir-classic) and other browsers (using watir-webdriver). I believe both gems are installed if you did gem install watir. This means you can do:
require 'watir'
# If you want to use Firefox
browser = Watir::Browser.new :firefox
# If you want to use IE
browser = Watir::Browser.new :ie
If you do not specify a browser the default will be IE on windows and Firefox on other platforms.

Related

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome version must be between 70 and 73 with ChromeDriver

I am trying to create a webcrawler using Selenium, but I get this error when I try to create the webdriver object.
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome version must be between 70 and 73
(Driver info: chromedriver=2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387),platform=Windows NT 6.1.7601 SP1 x86_64)
I downloaded the latest version of chromedriver (2.45) which requires Chrome 70-73. My current Chrome version is 68.0.3440.106 (Official Build) (64-bit), which is the latest. I tried downloading an "older" chrome version (71) and when I tried installing it, the installer indicated that I had a newer version already installed.
There doesn't seem to be any previous Chromedriver releases available for download, even though the website says there is. I couldn't find them.
I don't quite understand how version 71 is older than 68?
Is there a Chrome version newer than 68 actually available, or an older version of chromedriver i can use with Chrome 68?
Does anyone have any other suggestions?
This is the code that i'm trying to execute:
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
user = 'XXXXXXX'
pwd = 'XXXXXXX'
chromedriver = "...\...\...\chromedriver.exe"
driver = webdriver.Chrome(executable_path=chromedriver) # Error occurs at this line
driver.get("http://www.facebook.com")
assert "Facebook" in driver.title
time.sleep(5) # So i can see something!
elem = driver.find_element_by_id("email")
elem.send_keys(user)
time.sleep(5) # So i can see something!
elem = driver.find_element_by_id("pass")
elem.send_keys(pwd)
time.sleep(5) # So i can see something!
elem.send_keys(Keys.RETURN)
driver.close()
For me, upgrading the driver did the trick. Just run:
brew cask upgrade chromedriver
and then try running your test again. Hope it helps!
You can find the older versions of chrome driver here.
I dont think it is a good idea to install chrome from sources other than the official channel and installation of the same can cause issues. See if the google update service is running in your PC. This will automatically update the chrome version to latest. Mine is running Version 71.0.3578.98 (Official Build) (64-bit).
This error message...
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome version must be between 70 and 73
(Driver info: chromedriver=2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387),platform=Windows NT 6.1.7601 SP1 x86_64)
...implies that Chrome version must be between 70 and 73
Your main issue is the version compatibility between the binaries you are using as follows :
You are using chromedriver=2.45
Release Notes of chromedriver=2.45 clearly mentions the following :
Supports Chrome v70-72
You are using chrome=68.0
Release Notes of ChromeDriver v2.41 clearly mentions the following :
Supports Chrome v67-69
So there is a clear mismatch between ChromeDriver v2.45 and the Chrome Browser v68.0
Solution
Upgrade ChromeDriver to current ChromeDriver v2.45 level.
Keep Chrome version between Chrome v70-72 levels. (as per ChromeDriver v2.45 release notes)
Take a System Reboot.
Execute your #Test.
Alternative
Somehow I feel there are 2 versions of Chrome browser installed in your system. If that is the case you need to mention the absolute location of the Chrome binary within your program and you can use the following solution:
Code Block:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.binary_location = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
driver = webdriver.Chrome(chrome_options=options, executable_path="C:/Utility/BrowserDrivers/chromedriver.exe", )
driver.get('http://google.com/')
You can find a detailed discussion in Set chrome browser binary through chromedriver in Python
Note: You can find a relevant discussion in Session not created exception: Chrome version must be >= x.y.z when using Selenium Webdriver with Chrome
Reference
You can find a relevant detailed discussion in:
How to work with a specific version of ChromeDriver while Chrome Browser gets updated automatically through Python selenium
There are two options to resolve this issue:
1. If your Chrome version is not updated -> Update it
Steps: 1. Go to Help -> About Google Chrome -> Chrome will automatically look for updates(update Chrome to the latest version)
2. If your chrome version is already up to date -> Then you need to upgrade you chrome driver version
Here is the link: http://chromedriver.chromium.org/downloads
I encountered the same problem. I tried installing a downgraded version of Chrome (current stable was 74 and the driver required chrome version must be between 70-73) but I wasn't able to do so.
I found another way. This link will show you which version is compatible with your current google-chrome (to know your version the command is google-chrome --version)
This link will guide you as to how to install chrome driver with zip file. The commands are:
cd
wget <URL to zip file>
unzip chromedriver_linux64.zip
sudo mv chromedriver /usr/bin/chromedriver
sudo chown root:root /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver
In case the error comes No such file or directory: '/usr/lib/chromium-browser/chromedriver' OR the same error persists
Repeat the above procedure with the path /usr/lib/chromium-browser/chromedriver instead of /usr/bin/chromedriver
For me, google-chrome version 74 worked with ChromeDriver version 73
If you end up here and you're using Laravel / Dusk, try:
php artisan dusk:chrome-driver
Your chrome version is very old. Version 68 is not the latest version. For all operating systems, Chrome is currently in version 71+. Please see the list here.
Alternatively, this is the link for downloading older versions.
In Summary:
Find your chrome version (Help-> About Google Chrome)
Find your chromedriver version, if you already have one. (For me "chromedriver.exe -v" gave me the version on windows environment.)
Visit the official chrome webdriver page (http://chromedriver.chromium.org/downloads)
Download the chromedriver matching your chrome browser version, from the above download location.
Have a glance at the release notes on this download page towards lower section of the page, which gives an clear idea regarding which driver to use for which version of browser.
You can put the downloaded chromedriver binary in the path environment.
There you go. All the best!
Just download chromedriver extension 2.8 or 2.9 from here.
Extract it and add this extension to /usr/local/bin
I faced this issue due to mismatch of chromedriver and chrome version. I followed the below steps to resolve my issue:
1) First, find out which version of Chrome you are using. My Chrome version was 77.0.3865.90.
2) Take the Chrome version number, remove the last part, and append the result to URL "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_". For example, with Chrome version 77.0.3865.90, you'd get a URL "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_77.0.3865".
3) Use the URL created in the last step to retrieve the version of ChromeDriver to use. For example, the above URL will get your a file containing "77.0.3865.40". (The actual number may change in the future, of course.)
4) I then did :
webdriverdownloader chrome:77.0.3865.40 on my mac terminal.
After this your Chromedriver and Chrome version must be in sync and the issue should be fixed.
You have to match the chromedriver version number and your web browser chrome version ,
If both of the version match then it is best.
>
For Example -
1- your web browser chrome version is 77 ( For checking your web browser chrome version
got to your web browser help and then About Google Chrome there you will find
your web browser chrome version ) .
2- Now download same version here 77 chromedriver from https://chromedriver.chromium.org/downloads .
3- Make google chrome as your default web browser .
All done .
Your code will run fine.
from selenium import webdriver
driver=webdriver.Chrome("chromedriver.exe")
# Below line of code provide
driver.get('http://python.org')
html_doc=driver.page_source
print("Html code of http://python.org web page :",html_doc)

Installing GWT Developer Plugin on Linux

I have a sample app in GWT. When I run it and open in my Firefox - the browser still displays this:
Even if GWTP Developer plugin is sucessfully installed
My Firefox version is 25.0 (on Fedora 20), I know that the new versions of Firefox have problem with GWT plugin, but this version should be probably ok. What is the problem?
It's a known problem. Check this out: http://code.google.com/p/google-web-toolkit/issues/detail?id=8423
The solutions proposed there are to either:
download a special plugin that they've made for this bug
yum removing firefox and xulrunner and installing Firefox 25 from
ftp://ftp.mozilla.org/pub/firefox/releases/25.0/linux-x86_64/en-US/
You can also try upgrading to firefox 26, as the support was removed
in 27 and 26 should work fine with the normal plugin.

Capture with CasperJS does not render web fonts

I'm using Glyphicons in my page. It works well in Chrome. But when I use the capture()method from CasperJS, I see "crosses" instead of icons.
I didn't find any hack to achieve that.
phantomjs --version
1.9.7
casperjs --version
1.1.0-beta3

how to install chrome extension on Mac

Does anybody know how to install a chrome extension automatically on Mac (mountain lion)?
I have tried the method mentioned from chrome developper(but I don't see the "External Extensions" folder, and I also unzip the file directly into "Default/ID/Version/**". Both methods can not work.
Thanks
You can only install from the chrome store, or by drag&drop of the .crx on the extensions page

Which gem is supposed to use to work with firefox using watir

I Tried with Installing gem Watir-WebDriver but it is not working. It's saying:
C:\Ruby187>gem install watir web-driver
Successfully installed watir-2.0.4
ERROR: Could not find a valid gem 'web-driver' (>= 0) in any repository
ERROR: Possible alternatives: megadriver, view_driver, testdrive, app_driver, web-facter
1 gem installed
Installing ri documentation for watir-2.0.4...
Installing RDoc documentation for watir-2.0.4...
Did you mean watir-webdriver? If that doesn't work, can you post the output of gem source?
Take a look at this page on how to install watir-webdriver gem: https://github.com/zeljkofilipin/watirbook/blob/master/installation/windows.md
You are telling the system to install two gems, one named 'watir', the other named 'web-driver'.
The watir gem exists, and is being installed. However, it is only for driving IE (firefox used to be supported via firewatir, but changes post 3.6 made it impossible to continue to support 'firewatir')
There is no gem named 'web-driver' which is what the error is telling you.
What you want to install is watir-webdriver. This is a version of watir that uses webdriver to drive the browsers, and offers cross browser support including latest versions of IE, Firefox, and Chrome..
See the link #Zeljko provided for detailed installation instructions for watir-webdriver.
use gem install watir-webdriver.

Resources