Selenium webdriver 2, can't get IE8 to open - internet-explorer-8

I cannot get selenium to work with IE8. I am on a mac osx 10.5.8 with paralells virtual environment running Windows xp.
I have set up selenium and Ruby and my ruby scripts work fine with firefox in Windows but I can't get IE to work. I have downloaded selenium-server-standalone-2.8.0.jar and put it in my CLASSPATH but I think I have done it incorrectly.
This is the beginning of the error I get:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.8.0/lib/selenium/webdriver/common/driver.rb:43:in 'for': unknown driver: :internetexplorer (ArgumentError)
So my guess is that my Ruby script is bad and
"driver = Selenium::WebDriver.for :internetexplorer" is incorrect? Or I have set the CLASSPATH for selenium-server-standalone-2.8.0.jar incorrectly so that InternetExplorerDriver cannot be found.

I've found my mistake: To open internet explorer the driver should be either :ie or :internet_explorer.

Related

Ruby2d not working in WSL2 on Ubuntu 18.04 - Getting error "No available video device"

I'm using WSL2 on Ubuntu 18.04 to run Ruby code in Windows 10.
For example, running Ruby on Rails is easily done with no special setup required.
In case of Ruby2D:
The installation went fine but, I get an error when running any Ruby2D file, even the most basic one:
require 'ruby2d'
show
I get this error in Console:
error: XDG_RUNTIME_DIR not set in the environment.
Error: (SDL_Init) No available video device
error: XDG_RUNTIME_DIR not set in the environment.
Error: (SDL_CreateWindow) No available video device
Error: (GL2 / SDL_GL_CreateContext) Video subsystem has not been initialized
Error: An OpenGL context could not be created
How do I "add" (or config) a "video device" to my Ubuntu on the WSL2?
As you've noticed, WSL under Windows 10 doesn't have any GUI/X/windowing capabilities built in. There are a few possibilities:
If you have the ability to upgrade to Windows 11, it supports WSLg (built-in) for running Linux GUI apps directly on Windows. I did just install Ruby, ruby2d (and its dependencies) and was able to successfully execute your example. I assume it is just supposed to show a blank GUI window ...
If you can't upgrade to Windows 11, there are still several possible alternatives for running Linux GUI apps. I have not had a chance to test ruby2d in this type of environment, but I believe it should work. If you run into issues, I can at least get the first option up and running to try it out and see if we can work through it:
First, my preference is to install xrdp and a simple window manager like xfce. See my answer here for details and instructions. You don't need the full Gnome environment (which requires Systemd) - A simple installation of Xfce should do.
However, the most popular method is to install a third-party X server on Windows 10 and set up the DISPLAY variable manually. If you'd like to go this route, see this question and its answer for details.

Firefox cannot open "libgtk-3.so.0". How to circumvent?

I have two CentOS VMs which use Jenkins to run automated tests through firefox. Both have firefox installed. Both versions of firefox are the same (firefox-56.0.1). I do not know if they are both x86_64 or some other type, but whichever they are, they are the same. (I am using the same .tar.bz2 file. I copied it from one instance to the other.)
In one instance, I am able to run firefox. "firefox --headless" returns "*** You are running in headless mode."
After copying the .tar.bz2 file to the other instance and installing firefox, I find that the new instance does not have the same performance. "firefox --headless" returns the following:
XPCOMGlueLoad error for file /usr/local/firefox/libmozgtk.so:
libgtk-3.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.
What might explain this difference? It appears that I did something right in the first instance, but I cannot tell what. Is there some setting that will prevent firefox from trying to use the "libgtk-3.so.0" file? This file does not exist on either instance.
I've seen this question elsewhere, but the answer seems to focus on versions (I know my version has worked in the first instance) and a particular bug that has been backlogged (this bug only bothers me for the new instance).
Problem solved minutes after asking the question.
Simply run:
yum info gtk3
Check if gtk3 is installed. If not:
yum install gtk3
My old instance had gtk3 version 3.22.10 installed. My new instance had the same available but not installed. I don't recall seeing this in any of the guides to running firefox headlessly, but a search result that I did not originally think worth checking was able to resolve this rather quickly. Credit to the folks at https://forums.fedoraforum.org/showthread.php?310652-Udating-Firefox-fedora-19
For Ubuntu or Debian distros use:
apt-get install packagekit-gtk3-module
You probably installed the wrong firefox version for 32bit on a 64bit system.
try downloading firefox with this portable installer download-mozilla-portable.sh which should work on a 64bit linux (tested in Ubuntu 19.10)

Selenium::WebDriver::Error::UnknownError: unknown error: cannot find Chrome binary (Driver info: chromedriver=2.31.488774)

I'm trying to use Watir gem for writing scripts in ruby but the following code gives an error:
browser = Watir::Browser.new :chrome
Error:
Selenium::WebDriver::Error::UnknownError: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.31.488774 (7e15618d1bf16df8bf0ecf2914ed1964a387ba0b),platform=Mac OS X 10.12.5 x86_64)
Please let me know the solution to the above issue.
Remember,
You also need to have chrome installed on the machine in order for Selenium Chrome Driver to work.
There may be some libraries which the the version of chromedriver you're trying to install depends on. You need to install these libraries to start chromedriver.
How did I solve this?
I SSH'd into my testing environment and ran chromedriver (I am using the latest version at the time of this answer: 2.35 on Ubuntu Trusty 14.04)
chromedriver: error while loading shared libraries: libnss3.so: cannot open ...
This is the Network Security Service library. Other versions may require some other libraries to be installed. Checkout this answer for more on this.
So I installed the library using apt-get.
p.s: Make sure you have Chrome installed in the box too. If you're using CircleCI, checkout this tip.
This means that your script is unable to find the Chrome driver browser executable. Make sure that you have downloaded the Chrome browser from here. Additionally, from the ChromeDriver Capabilities docs,
Path to the Chrome executable to use (on Mac OS X, this should be the actual binary, not just the app. e.g., '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome')
The solution is to add the location of the Chrome or Chromium app to your PATH. You likely tried to organize the apps on your Mac and did not put Chrome directly in the Applications folder.
However it came to be, the folder containing the Chrome or Chromium .app is not in your PATH. To remedy it, edit your ~/.bash_profile and add a line such as:
export PATH="$PATH:/Applications/Web"
In this example, I have put all of my browsers in a folder called "Web" inside of Applications.
The more technical explanation is that chromedriver searches for a specific subpath within each entry in your PATH. The code that does it is here:
Chromedriver Source Code

Specifiying firefox 3.6.3 in custom browser path selenium RC

after specifying custom browser path to firefox 3.6.3 selenium couldnt able to open the testsuite.
<*custom c:/program files/mozilla/firefox.exe>
but error message appeared through RC server that it cannot open the firefox version.
also i am confuse to use custom path through selenium ,
any one please help me out,
To use your firefox 3.6.3, you can use *firefox "Path to firefox.exe" or *chrome "Path to firefox.exe"
Also, make sure you are using the correct path to firefox.exe.

selenium RC running on solaris error when opening firefox:symbol g_slice_set_config: referenced symbol not found

I am runing selenium-RC in solaris to launching web automation testing. In fact, I have used selenium in windows with no problems. And it works.
But now, I want to make automation testing on solaris server, so I start selenium RC on solaris. But when it opening a firefox, the error will come out:
ld.so.1: firefox-bin: fatal: relocation error: file /export/home/linus/..../firefox3.5/libxul.so: symbol g_slice_set_config: referenced symbol not found
13:11:22.400 ERROR - Failed to start new browser session, shutdown browser and clear all session data
java.lang.RuntimeException: Timed out waiting for profile to be created!
But without selenium, I can open firefox in solaris with no problems. I am very confused about this problem. Does it come from selenium or firefox? Could anybody help me with this? Thanks a lot!
P.S. I installed firefox3.5 on my solaris server. And it is in the route /export/home/linus/.....firefox3.5
Problem solved: it seems my firefox has some problem. I install another firefox, it solved the problem.
http://opensolaris.org/jive/thread.jspa?messageID=425759

Resources