What is the process for setting up geckodriver to have a trace log level using firefox_options?

When attempting to execute selenium on a VPS for running tests in Python, I encountered an issue. Here's the Python code snippet:

from selenium import webdriver
from selenium.webdriver.firefox.options import Options

options = Options()
options.log.level = 'trace'
selenium = Firefox(firefox_options=options)

However, upon execution of the script, an error occurs:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  ...
selenium.common.exceptions.WebDriverException: Message: connection refused

Although Firefox starts successfully, it becomes inaccessible after Python raises an exception rendering it useless.

In the geckodriver.log file, the following log entries are recorded:


1540423460336   geckodriver INFO    geckodriver 0.21.0
...
New connections will no longer be accepted

Are there any alternative debugging methods you can suggest for troubleshooting this issue?

The current environment setup is as follows: Python 2.7

Selenium 3.14.1

Firefox 59.0.2 (errors also occur with ff62)

Geckodriver 0.21 (similar errors persist with version 0.23)

Answer №1

According to the official documentation found at selenium.webdriver.firefox.options for Selenium Python Client v3.14.0, it is recommended to utilize the following:

class selenium.webdriver.firefox.options.Log

Here is an example code snippet demonstrating how to implement this:

from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.options import Log

log = Log()
log.level = "TRACE"
options = Options()
options.add_argument(log.level)
browser = webdriver.Firefox(firefox_options=options, executable_path="C:\\path\\to\\geckodriver.exe")
browser.get('http://google.com/')

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Transmit information from an HTML input field (not a form) to a Python CGI script through AJAX

I am currently facing a challenge where I need to send data programmatically without using form fields directly to a python CGI script. The issue lies in not knowing how to extract this data in Python. Normally, with a form, I could use "form = cgi.FieldSt ...

Retrieving data from an HTML element using Java within the Selenium framework

Can anyone help me extract "name":"test_1476979972086" from the HTML tag below using Java Selenium code? I have attempted to use both the getText and getAttribute functions without success. <a data-ng-href="#/devices" target="_blank" class=" ...

Having issues with setting up the matplotlib library in PyCharm

Every time I try to execute the commands below, pip install matplotlib or pip3 install matplotlib I encounter an unfamiliar error message. This is a unique occurrence for me. PS D:\Desktop\Reinforcement Learning> pip install matplotlib ...

Looking to determine the quantity of elements sharing a particular CSS selector in Selenium using Java?

Currently, I am utilizing the most up-to-date version of selenium in conjunction with java programming language. I am facing a challenge where I need to determine the number of elements on a specific webpage that share the same css selector. However, usin ...

XPath command that selects a link to be clicked if a unique identifier is present in the adjacent sibling

How do you locate and click on a link (< a >) using the correct xpath, when the unique identifier ("Column3") is within a sibling tag? <th ...> <th ...> <th> <span>Column3</span> <a onClick="removeColumn(colum ...

Despite there being no duplicate class name, Selenium is still having trouble locating the element

I am facing an issue with my code while trying to locate an element on the Nordstrom Rack website. Despite there being no duplicate class name, the element "Account" (after signing up) is not being recognized. using NordstromRack.UI_Elements; using OpenQA ...

issue with accessing global variable within class block

While the Python code within the 'outer' function runs smoothly on its own, placing it inside a class seems to cause issues that are difficult for me to comprehend. (I am aware that I could simply pass data as a variable inside the function or d ...

bring to life with varying durations

I am currently working with trajectory data that includes individual start times for each vehicle. Each vehicle represents a point in an animation, with coordinates (x,y) and timestamps provided in the dataset. Using a fixed time interval does not suit my ...

Adding prices from two inputs in Python using a dictionary

There are 2 inputs: # The key represents available dates and the value represents the price a = {"g": 109192, "e": 116374, "o": 183368, "s": 162719} # User input of desired dates, separated by spaces b = ("g&qu ...

Exploring the depths of the internet with Tor Browser and RSelenium on both Linux

Seeking to implement RSelenium and Tor on my Linux machine in order to retrieve the Tor IP with Firefox as the Tor Browser. While this is achievable with Python, I am encountering difficulties in R. Can anyone help get this to function? Feel free to share ...

Unleash the power of arrays within arrays in PySpark to enhance your column explosion

I am looking to break down the data in a specific column: [[[-77.1082606, 38.935738]] ,Point] My desired output format is: column 1 column 2 column 3 -77.1082606 38.935738 Point Is there a way to achieve this using PyS ...

Using Python to terminate a process results in a "Permission denied" error

Currently, I have a python script set up to manage the tcpdump tool. The issue arises when attempting to terminate the tcpdump process within my python script: import subprocess pid = 9669 # pid of the tcpdump process subprocess.call(["sudo", &q ...

Exploring the possibilities of integrating jQuery into Firefox extensions

Can someone provide guidance on effectively implementing jQuery within a Firefox extension? My research has not yielded any up-to-date methods that address the latest version of jQuery, and I am aware that directly including it via script tag may lead to c ...

Retrieving text from a collection of Web Elements can be time-consuming

I have written a code to extract data from a web table, where each row is read as text and added to another list before being sent to a method for writing to an excel file. However, this process of reading approximately 200 rows and writing the data to a n ...

Complete testing with Selenium using various programming languages

Let's address the issue: We currently have a robust system in place with selenium page objects and methods for each segment of our platform. The challenge lies in the fact that each selenium project is coded in the same language as its corresponding ...

Issue with chromedriver locating element on Polymer site

I am currently working on an automation project using Selenium, which involves calling the Chrome webdriver to run test cases. However, I have encountered an issue with Chromedriver not being able to locate elements on websites built with the Polymer frame ...

Selenium error: Unable to detect symbol

After following a tutorial on YouTube, I decided to copy and paste the code generated by Selenium IDE export function into my class file instead of typing my own. However, I encountered several errors with unknown symbols. I thought Maven was supposed to r ...

Differentiating between the components and contents of a webpage during the process of web scraping

import mechanize from bs4 import BeautifulSoup import urllib2 import cookielib cj = cookielib.CookieJar() br = mechanize.Browser() br.set_handle_robots(False) br.set_cookiejar(cj) br.open("*******") br.select_form(nr=0) br.form['ctl00$BodyConten ...

The error message saying "edit() takes 1 positional argument but 2 were given" is incorrect as I only provided one argument. [Discord.PY]

Hi there! I'm currently working on a fun hack command for a Discord Bot (just for laughs) and I've encountered a strange error. The error message claims that I've provided 2 arguments instead of the expected 1 argument, even though it appear ...

Efficiently handling a group of buttons in PyQt5 without the need to manually assign specific actions to each button

I'm currently working on designing a user interface layout that involves multiple buttons where clicking each button will toggle between adding 1 or 0 to a specific position in a list. However, I am facing challenges in managing a cluster of 48 button ...