- Как установить прокси SOCKS5 с аутентификацией для Chrome в Селене Python?
- 5 ответов
- Saved searches
- Use saved searches to filter your results more quickly
- TufayelLUS/Python-Selenium-Use-Authenticated-Proxy
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- You can try following alternative : —
- On windows, for http/https proxy with or without authentication, run one of the following commands in cmd.exe :-
- Related Query
- More Query from same tag
Как установить прокси SOCKS5 с аутентификацией для Chrome в Селене Python?
Я пытаюсь использовать прокси SOCKS5, предоставленный PIA (https://www.privateinternetaccess.com). Я создал пользователя/пароль для SOCKS5 на своем сайте, но я не могу использовать эту информацию, так как не знаю, где ее разместить. Я попытался использовать ChromeOptions , но он не работает.
def create_browser(self, proxy): """ proxy /cdn-cgi/l/email-protection" data-cfemail="a2e5c7ccc7d0c3d6c7c6f2c3d1d1e2d2d0cddadb8fccce8cd2d0cbd4c3d6c7cbccd6c7d0ccc7d6c3c1c1c7d1d18cc1cdcf">[email protected]:1080" """ chrome_options = webdriver.ChromeOptions() if proxy: chrome_options.add_argument("--proxy-server=socks5://" + proxy) try: self.browser = webdriver.Chrome('./chromedriver', chrome_options=chrome_options) self.browser.set_window_size(800, 600) except Exception as error: return False
Ну, не уверен, что я помогаю, но просто знайте, что Squid — это хороший и быстрый способ настроить прокси http на socks5. Вы просто должны установить прокси Chrome для локального http на прокси socks5.
Я ответил на ваш вопрос, также рекомендуется использовать PhantomJS вместо драйвера GoogleChrome, поскольку он использует немного больше места / памяти / процессора.
5 ответов
Я тоже в тупике. Я также хочу использовать прокси-сервер авторизации в Chrome WebDriver Selen. Я попытался использовать httpProxy или PAC, в котором мы не можем использовать имя пользователя и пароль.
А потом я увидел socksUsername и socksPassword но он все еще бесполезен. Потому что ошибка:
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: cannot parse capability: proxy from invalid argument: Specifying 'socksProxy' requires an integer for 'socksVersion' (Driver info: chromedriver=73.0.3683.20 (8e2b610813e167eee3619ac4ce6e42e3ec622017),platform=Mac OS X 10.14.3 x86_64)
Я обнаружил, что хром-код говорит, что socksProxy ключ socksProxy , но текущий селен не поддерживает socksProxy, см. Код селена.
Поэтому я должен выбрать другой путь:
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Code for using authenticated proxy with selenium chromedriver in python
TufayelLUS/Python-Selenium-Use-Authenticated-Proxy
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
How to use authenticated proxy in selenium python chromedriver
Code for using authenticated proxy with selenium chromedriver in python. It enables you to use authenticated proxies in selenium chromedriver for python (normally selenium doesn’t allow user authentication for proxies, this code enables this support with help of plugin)
To change protocol of the proxy (http/https/socks5)
This plugin code was taken from the internet and been modified to execute with function call.
About
Code for using authenticated proxy with selenium chromedriver in python
You can try following alternative : —
On windows, for http/https proxy with or without authentication, run one of the following commands in cmd.exe :-
set http_proxy=http://your_proxy:your_port set http_proxy=http://username:password@your_proxy:your_port set https_proxy=https://your_proxy:your_port set https_proxy=https://username:password@your_proxy:your_port
Shubham Goyal 11
In case anyone stumbles on this.
I was trying to connect with a socks5 proxy with selenium and believe the issue was that the proxy requires user/pass auth, and since I was using the chromedriver it did not work because chrome does not natively support this.
Try connecting with a socks5 proxy that does not require auth or finding a driver that supports this — not aware of which/what this might be though.
I am stumping in here too. I also want to use auth proxy in the chrome webdriver of selenium. I have tried use httpProxy or PAC, in which we cannot use username and password.
And then I saw the socksUsername and socksPassword but it is still useless. Because the error:
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: cannot parse capability: proxy from invalid argument: Specifying 'socksProxy' requires an integer for 'socksVersion' (Driver info: chromedriver=73.0.3683.20 (8e2b610813e167eee3619ac4ce6e42e3ec622017),platform=Mac OS X 10.14.3 x86_64)
I found chrome code said need the socksProxy key, but the current selenium is not support socksProxy, see selenium code.
So I have to choose other way:
UPDATE: Finally, I use pproxy make as a proxy redirector on local.
# pproxy -r $\#$ -l http://:8080 -v # 1.2.3.4:1234 is remote address:port, username and password is used auth for remote proxy. pproxy -r http://1.2.3.4:1234\#username:password -l http://:8080 -v
So now your can connect to your localhost:8080 without auth.
michael 694
Related Query
- Unable to Open Chrome WebDriver with Selenium for Python
- How to set values for AngularJS controller variables using python Selenium or JavaScript console?
- python selenium Chrome Web Driver. How to Proxy IP/ Where to buy
- How to single out results with soup.find() in Beautifulsoup4 for Python 3.6?
- How to initiate Chrome Canary in headless mode through Selenium and Python
- python selenium not running with chrome driver & chrome version
- How to check for updates in the HTML with python requests
- How to use an existing google chrome profile with selenium chrome webdriver in python?
- Entering basic auth popup info with python and chrome > 59
- Can’t see result of opening Chrome browser with Python Selenium
- Using Chrome Driver with Selenium webdriver.Remote Python
- How to randomly select one nonzero element per row from a sparse matrix with out for loop in python
- how to make specific polynomials in a set with python
- Python Selenium — How do you click on every row element for column of web table?
- How to spoof time zone in Selenium on windows for gecko and chrome drivers?
- How do I set arguments via the Python script for Youtube API
- How to get contents of a text box using selenium with python
- How to manually set net and other parameters for a solver in caffe python programming?
- Apache Spark: How to use Python 3 with pySpark for development
- How to set specific Hadoop version for Spark, Python
- How to correctly setup redirection with Python Requests for some corner-cases
- How to set screen resolution in PhantomJS with python
- How to read all text with tag by using ElementTree for python
- type of value in for loop by default in python and. how typeof is set in a loop
- How do you loop through a web page for content using Python Selenium
- Selenium python (webdrivers): how to handle cases with multiple interconnected windows
- Python selenium phantomJS with luminati proxy
- How to open Google chrome using selenium in a custom profile in python [Operating System: Ubuntu]
- How to create a keyframe with Python API for 3D Studio Max
- Using python to parsing a log file with real case — how to skip lines in csv.reader for loop, how to use different delimiter
- How can I get a proxy list to work with selenium properly? (python)
- How to set hidden property of a file with python
- How to set limitations for excel file with xlsx writer
- How to setup airflow with python for a windows development environment
- Python Lists — How do I use a list of domains with dns.resolver.query for loop
- How to test text nodes rendered with React using Selenium Python
- How encoding correctly for mailing with smtplib in Python
- How to look for a form after URL redirect with mechanize and python
- Python : Dictionary with one key and multiple values : How to get list of keys having same SET of values?
- How to install Selenium for Python and C#
- Using with python selenium WebDriverWait in pysaunter for async pages?
- How to click on a button webelement using css_selector with Selenium webdriver for identical button types
- Using set input for stdin based on output from stdout with python subprocess
- How can I configure proxy settings using pure python with pywebkit
- How to create separate files with dependencies for Cython and how to fix compilation error: Cannot convert Python object to ‘mySet*’
- How to access Gmail’s «Send» button using Selenium RC for Java or C# or Python
- How to click on element which contains a credit card number that changes each time with Selenium Python
- How to set multiple strings for Python Enum?
- How can I set the timezone to New York with python MySQL Connector?
- How to wait for second dropdown to load based on the first using Selenium in Python
More Query from same tag
- Using for loops to create reversed numbered lists
- python list different way than googles solution
- reassigning elements of a dict which uses both a string and a variable
- Parsing a Dynamic Web Page using Python
- How to find the maximum distance between five points?
- Converting string into a value
- Convert list of values into list of strings
- Python library module implementation
- Can’t extract second web-page. Cross-Origin Read Blocking
- How to Login to a Page Where Logins are Optional
- obtain current status of Wikipedia articles?
- Pyqtgraph Setting Label Styles
- Python 3.2: Information on class, class attributes, and values of objects
- How to assign values to class instance attributes in a loop
- Using JSON with AJAX and Python database
- correct encoding in ecdsa, python
- The best pythonic way to clean a string
- Read python dictionary using c++
- How to take user input and use the if else function to give outputs
- Unicode string as key to python dictionary
- How to check template context using Pyramid + webtest
- Editing csv file Python 3 — matching file content to the print output
- Python — double loop for element wise string concatenation
- Getting C# Int64 in Python
- python dictionary manipulation not working
- Webscraping in Python with Beautifulsoup
- tkinter Frame does not detect event
- How to install packages with python scripts
- sqlalchemy not setting timestmap default
- All instances of a class have the same dict as an attribute in Python 3.2
- Python3.x: quickest way to replace characters in very large string
- check if a value is in several lists
- How do I write a MySQL LIKE clause using qmark syntax with the oursql Python library?
- Python — Iterating through array in an unorthodox manner
- Check if Last Character in a String is Not a Letter