question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[🐛 Bug]: PySelenium doesn't support a named pipe as a log file

See original GitHub issue

What happened?

As part of OpenWPM we use Selenium to drive multiple Firefox browsers in parallel.

To capture, enrich and redirect the browser’s logging output, we use named pipes that look like normal log files to Selenium. However pipes don’t support seeking so the need to be opened with w and not with a+ as the firefox.Service currently does. We have previously monkeypatched this but that approach has led to us breaking every time a new Selenium release comes out. A newer approach that tries to call firefox.Service.__init__ and open the log_file afterwards doesn’t work at all, so I wanted to check if there was an appetite to address this issue upstream.

How can we reproduce the issue?

import os
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.service import Service
pipe_name = "selenium_pipe.log"
os.mkfifo(pipe_name, 0o600)
service=Service(executable_path="firefox",log_path=pipe_name)
driver = Firefox(
    service=service
)
driver.get("https://example.com")

Relevant log output

File "/home/vringar/selenium_mvp/demo.py", line 9, in <module>
    service=Service(executable_path="firefox",log_path=pipe_name)
File "/home/stefan/.conda/envs/openwpm/lib/python3.10/site-packages/selenium/webdriver/firefox/service.py", line 50, in __init__
    log_file = open(log_path, "a+") if log_path else None
io.UnsupportedOperation: File or stream is not seekable.

Operating System

Linux

Selenium version

Python 4.1.0

What are the browser(s) and version(s) where you see this issue?

Firefox 100

What are the browser driver(s) and version(s) where you see this issue?

GeckoDriver 0.30.0

Are you using Selenium Grid?

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
symonkcommented, May 27, 2022

Thanks @vringar seems ok to me, we could expose the mode to the user too to simplify the solution but your proposal seems ok to me too

0reactions
vringarcommented, May 27, 2022

Looks like you already have the code; please PR your proposed changes

Done

and discuss whatever impact it might have on existing users. We have a *lot of work planned in Python for 4.3.

I have done that in the PR. Should I do it here as well?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Broken pipe error selenium webdriver, when there is a gap ...
This bug originates from newly added support in v 0.21 of Keep-Alive feature. However, the default timeout from geckodriver in 0.21 is set ......
Read more >
Chrome Driver Issue while executing Selenium Tests
Hi all, I am executing some Selenium tests and I am getting the below error now.It was working fine until yesterday with same...
Read more >
Common Error Messages - Sauce Labs Documentation
The most common causes for this error are either unresponsive JavaScript in your app, or a bug in Selenium/Appium. A less common, but...
Read more >
Robot Framework User Guide
The official RPA support was added in Robot Framework 3.1. This User Guide still talks mainly about creating tests, test data, and test...
Read more >
Local testing errors and troubleshooting | BrowserStack Docs
... Local Testing with BrowserStack, you may encounter the following error: ... Key set in the test script and the BrowserStack Local binary...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found