-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebDriver failure with latest Selenium Server #20
Comments
Your tutorial documentation uses: |
I tried each of the Selenium-Server versions backwards and found that version 4.8.3 works. |
I wonder if this is simply an incompatibility between the browser and the latest selenium server. Are you using a recent version of Firefox or some LTS version maybe? |
Hm, no, it also doesn't work with chromedriver. |
Then probably some backwards-compatibility was removed. This Tcl module was written years ago, even before WebDriver became a W3C standard, so there may be things in there that simply aren't compliant with the standard. |
It's probably about how the session is being requested. I see things have changed. There are no desiredCapabilites and requiredCapabilities anymore. Instead there is alwaysMatch and firstMatch. |
Firefox Version Would be useful to get the minimal tcl code to make Selenium-Webdriver start chrome instead of firefox. I tried the following to no avail: But then the same cmd in the following for firefox fails: I am able to do the following successfully.
Server java -jar selenium-server/selenium-server-4.8.3.jar standalone --host 127.0.0.1 --port 4445 --http-logs true --log-level INFO ; Client /usr/bin/tclsh ;
package require WebDriver ;
set caps [ namespace which [ WebDriver::Capabilities #auto -browser_name firefox ]] ;
set session [ WebDriver::Session #auto http://127.0.0.1:4445/wd/hub $caps ] ;
# Now we have a running instance of the firefox browser.
set window [$session active_window] ;
set url "https://duckduckgo.com" ;
$window set_url $url ;
# Now the browser has opened the website.
set elements_name [ $window elements by_xpath {//*[@name]} ] ;
set e_search_field [ lindex $elements_name end-1 ] ;
set e_search_button [ lindex $elements_name end ] ;
$e_search_field click ;
$e_search_field clear ;
$e_search_field send_keys "google" ;
$e_search_button submit ; I'm no Itcl expert, so debugging this is a challenge. |
I want to use Caius to be able to launch the Firefox browser with a specific user profile. I tried to look through the source code, but I'm not sure whether passing cmdline args to Firefox is supported. Any help would be much appreciated.
OS Platform lsb_release -a ;
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy Installation sudo apt-get install python3 python3-pip ;
pip3 install selenium webdriver-manager ;
pip3 install -U selenium ;
pip3 install -U webdriver-manager ; Prequisites # Create Firefox user profile and note the location of the user profile directory.
firefox -ProfileManager ; web_user_profile.py import sys
import time
import os
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.service import Service
from webdriver_manager.firefox import GeckoDriverManager
options = Options()
options.page_load_strategy = 'normal'
profile_arg_param = '-profile'
# This is usually where the Firefox user profile is created.
profile_arg_value = os.getenv('HOME') + '/snap/firefox/common/.mozilla/firefox/WHATEVER_NAME_OF_THE_USER_PROFILE'
options.add_argument(profile_arg_param)
options.add_argument(profile_arg_value)
# Start an instance of the Firefox browser.
browser = webdriver.Firefox(service=Service(GeckoDriverManager().install()), options=options)
# Load URL
url = "about:profiles"
browser.get(url)
# Sleep, close browser and exit.
time.sleep(10) ;# This should give you enough time to look at the user profile used by the browser.
browser.close()
exit() |
I might be missing something in the execution. Any help would be greatly appreciated!
Install: Caius
https://github.com/tobijk/caius.git
Download: Selenium Server
https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.9.0/selenium-server-4.9.1.jar
Execute: Server Start
Execute: Client Start
Log: Server
The text was updated successfully, but these errors were encountered: