回答編集履歴
1
追記
answer
CHANGED
@@ -13,4 +13,25 @@
|
|
13
13
|
driver = webdriver.Firefox(firefox_profile= profile, executable_path=r'/Users/xxx/geckodriver')
|
14
14
|
driver.get("http://check.torproject.org")
|
15
15
|
driver.get("https://google.co.jp/")
|
16
|
+
```
|
17
|
+
|
18
|
+
```Python
|
19
|
+
from selenium import webdriver
|
20
|
+
import os
|
21
|
+
|
22
|
+
# To use Tor's SOCKS proxy server with chrome, include the socks protocol in the scheme with the --proxy-server option
|
23
|
+
# PROXY = "socks5://127.0.0.1:9150" # IP:PORT or HOST:PORT
|
24
|
+
|
25
|
+
torexe = os.popen(r'C:\Users\Owner\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe')
|
26
|
+
PROXY = "socks5://localhost:9050" # IP:PORT or HOST:PORT
|
27
|
+
options = webdriver.ChromeOptions()
|
28
|
+
#options.add_argument('--headless')
|
29
|
+
options.add_argument("start-maximized")
|
30
|
+
options.add_argument("disable-infobars")
|
31
|
+
options.add_argument("--disable-extensions")
|
32
|
+
options.add_argument('--proxy-server=%s' % PROXY)
|
33
|
+
driver = webdriver.Chrome(chrome_options=options, executable_path=r'/Users/xxx/chromedriver.exe')
|
34
|
+
driver.get("http://check.torproject.org")
|
35
|
+
driver.get("https://google.co.jp/")
|
36
|
+
print (driver.title)
|
16
37
|
```
|