Comments (6)
Example using Twitter login:
from tbselenium.tbdriver import TorBrowserDriver
pref_dict = {'network.proxy.no_proxies_on': '.twitter.com'}
with TorBrowserDriver("/opt/tbb/tor-browser_en-US/", pref_dict=pref_dict) as driver:
driver.implicitly_wait(5)
driver.get('https://twitter.com/login')
username_field = driver.find_element_by_css_selector('input[class="js-username-field email-input js-initial-focus"]')
username_field.send_keys('<TWITTER_USERNAME>')
password_field = driver.find_element_by_css_selector('input[class="js-password-field"]')
password_field.send_keys('<TWITTER_PASSWORD>')
submit_button = driver.find_element_by_css_selector('button[class="submit btn primary-btn"]')
submit_button.click()
print driver.current_url
print driver.get_cookies()
This outputs:
https://twitter.com/
[]
from tor-browser-selenium.
Thanks for reporting.
I tried with vanilla FirefoxDriver and get the same result (no cookies).
Also, reading https://github.com/robotframework/Selenium2Library/issues/177, I'm thinking that this may be a FirefoxDriver issue.
If that's compatible with what you're doing, you can disable PBM to access cookies.
Just add "browser.privatebrowsing.autostart": False
to the pref_dict
you have.
(Idea from https://github.com/robotframework/Selenium2Library/issues/177#issuecomment-37808376)
Disabling PBM may have side effects like storing things on the disk, please make sure it's OK for your case.
You can also use driver.execute_script("return document.cookie")
, but httponly
cookies will be missing in the list.
from tor-browser-selenium.
That config fixes it, 10,000 thanks!
Feel free to close this issue – I'll circle back with SecureDrop people to see if that's an acceptable bit of config to have in the tests.
from tor-browser-selenium.
I'm glad it worked. Maybe I should add a note about this in the troubleshooting section.
Thanks again for reporting.
from tor-browser-selenium.
Note: "browser.privatebrowsing.autostart": False
works when working against 127.0.0.1 address, but not with the onion addresses. Could not find an way to get the cookies.
from tor-browser-selenium.
I could print the cookies on http://www.propub3r6espa33w.onion/
using the following code: https://gist.github.com/gunesacar/0e0acfa8d71deffe6c45ccd29b8247f1
I run the following...:
python cookie_check.py /path/to/tor-browser_en-US/ https://www.propub3r6espa33w.onion/
...it prints (along with a ton of other debug messages from Firefox):
Finished loading https://www.propub3r6espa33w.onion/
Cookies: pp-tracking={"pageCount":0}; __gads=ID=5b2f86bbd40732dd:T=1517883426:S=ALNI_Mb57Tl8YkAq9jenlcBbufsbX9yLJQ```
from tor-browser-selenium.
Related Issues (20)
- Geckodriver is unavailable if all ports are closed by default HOT 3
- The bridge configuration does not take effect
- The bridge configuration does not take effect HOT 1
- disable images loading HOT 1
- почему не поддерживает виндовс и когда будет если будет HOT 1
- Message: Process unexpectedly closed with status 1 HOT 2
- Error with the new version of selenium or python-selenium HOT 2
- Cannot install extensions. HOT 9
- Compatible versions - WebDriverException Message: Process unexpectedly closed with status 255 HOT 9
- Use custom tor build HOT 1
- Message: Process unexpectedly closed with status 1 HOT 2
- Initialization error with Selenium 4.11 HOT 2
- Help me on Mac gecko driver HOT 1
- error with selenium 4.11 and driver HOT 1
- Trouble with tor binary HOT 14
- Cannot install tbselenium HOT 4
- Invalid firefox binary HOT 2
- Process unexpectedly closed with status 255 HOT 1
- Headless mode fails since Selenium 4.12.0 HOT 1
- pip install error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tor-browser-selenium.