webfp / tor-browser-selenium

Tor Browser automation with Selenium.
MIT License
528 stars 101 forks source link

self.capabilities AttributeError #165

Closed dveit closed 2 years ago

dveit commented 2 years ago

I tried to use tbselenium for my project and got an error every time, so I blamed my code for that. But after trying the sample code from this repo I got the same problem. Code:

from tbselenium.tbdriver import TorBrowserDriver

TBB_PATH = "mypath/tor-browser_en-US/"

def main():
    with TorBrowserDriver(TBB_PATH) as driver:
        driver.get("https://check.torproject.org")

if __name__ == "__main__":
    main()

Error:

Traceback (most recent call last):
  File "test.py", line 12, in <module>
    main()
  File "test.py", line 7, in main
    with TorBrowserDriver(TBB_PATH) as driver:
  File "myproject/venv/lib/python3.8/site-packages/tbselenium/tbdriver.py", line 53, in __init__
    self.setup_capabilities(capabilities)
  File "myproject/venv/lib/python3.8/site-packages/tbselenium/tbdriver.py", line 255, in setup_capabilities
    self.capabilities = {
AttributeError: can't set attribute
gunesacar commented 2 years ago

Thanks for reporting @dveit. Selenium 4 has major breaking changes, and this issue you report is one of them. I'm working on making tor-browser-selenium compatible with it. I hope to release it very soon.

gunesacar commented 2 years ago

Should be fixed in https://github.com/webfp/tor-browser-selenium/pull/166. Closing.