GithubHelp home page GithubHelp logo

Comments (9)

gunesacar avatar gunesacar commented on June 21, 2024

The following combination works on Travis CI and on my local 23.04 Ubuntu. Please make sure you upgrade your selenium Python package as well:

  • geckodriver: 0.31.0 (see, the explanation here)
  • selenium: 4.10.0
  • TB: 12.0.7

In similar future cases, you may check the CI logs to see what version of packages are used in the tests:
https://api.travis-ci.com/v3/job/603956148/log.txt

from tor-browser-selenium.

GraemeMeyerGT avatar GraemeMeyerGT commented on June 21, 2024

Ah I was behind in Selenium version (4.9.1). However, once upgraded to 4.10.0, I now receive following error:

/bin/python /opt/test/test.py
Traceback (most recent call last):
  File "/opt/test/test.py", line 21, in <module>
    main()
  File "/opt/test/test.py", line 17, in main
    headless_visit("/opt/tor-browser")
  File "/opt/test/test.py", line 9, in headless_visit
    with TorBrowserDriver(tbb_dir) as driver:
  File "/home/ctiuser/.local/lib/python3.10/site-packages/tbselenium/tbdriver.py", line 98, in __init__
    super(TorBrowserDriver, self).__init__(
TypeError: WebDriver.__init__() got an unexpected keyword argument 'executable_path'

Versions:

geckodriver --version
geckodriver 0.31.0 (b617178ef491 2022-04-06 11:57 +0000)

python --version
Python 3.10.6

pip list 
Package                Version
---------------------- -------------
...
PyVirtualDisplay       3.0
...
selenium               4.10.0
...
tbselenium             0.6.3
...

That's for the following code sample:

from tbselenium.tbdriver import TorBrowserDriver
from tbselenium.utils import start_xvfb, stop_xvfb
from os.path import join, dirname, realpath

def headless_visit(tbb_dir):
    out_img = join(dirname(realpath(__file__)), "headless_screenshot.png")
    # start a virtual display
    xvfb_display = start_xvfb()
    with TorBrowserDriver(tbb_dir) as driver:
        driver.load_url("https://check.torproject.org")
        driver.get_screenshot_as_file(out_img)
        print("Screenshot is saved as %s" % out_img)

    stop_xvfb(xvfb_display)

def main():
    headless_visit("/opt/tor-browser")


if __name__ == '__main__':
    main()

Has the order/default arguments for TorBrowserDriver changed? I had thought that tbb directory path supplied as the only argument was previously valid

from tor-browser-selenium.

GraemeMeyerGT avatar GraemeMeyerGT commented on June 21, 2024

Ah I see this is likely fixed in 0254df1. (and same as #187) - is a version containing that fix due for release any time soon? Should I try to use that commit directly?

from tor-browser-selenium.

gunesacar avatar gunesacar commented on June 21, 2024

Will do a release by the end of day today. Thanks for pointing it out.

from tor-browser-selenium.

GraemeMeyerGT avatar GraemeMeyerGT commented on June 21, 2024

Ah wonderful. Thank you! 🙏

from tor-browser-selenium.

gunesacar avatar gunesacar commented on June 21, 2024

New release is up: https://pypi.org/project/tbselenium/0.7.0/

Thanks for filing the issue.

from tor-browser-selenium.

gunesacar avatar gunesacar commented on June 21, 2024

Feel free to reopen if you still see issues.

from tor-browser-selenium.

GraemeMeyerGT avatar GraemeMeyerGT commented on June 21, 2024

Thanks @gunesacar. I am still experiencing the issues, but I think I have narrowed it down to display issues. I have a full desktop Ubuntu 22 with GUI where it works fine, but I cannot get it working on the headless Ubuntu 22 used in Azure. Even using xvfb_display = start_xvfb() as in the headless example doesn't work.

Currently trying various iterations of virtual displays, xfce4 etc. to do some debugging, but it's slow going. I did have success by installing a full desktop environment and rdp server (per Azure instructions), and I think I also had to install the full Firefox package.

I'm sure this isn't really your problem or anything to do with your software, but if you have any tips for making it work, they would be really appreciated. You wouldn't think it would be difficult to run a headless program on headless server 😕

from tor-browser-selenium.

GraemeMeyerGT avatar GraemeMeyerGT commented on June 21, 2024

Okay I've given up trying to keep this headless, and am just installing a desktop environment on Ubuntu to keep the Tor Browser happy.

From the Azure instructions, all that is required is:

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install xfce4
sudo apt install xfce4-session

I was previously working with a light version of xfce4, which introduced further problems, so despite the fact the full version is quite heavy, if anyone in future wants to avoid the trouble, I suggest installing the full xfce4 version.

With that installed, all seems to work well. Thanks once again.

from tor-browser-selenium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.