回答編集履歴
1
追記
test
CHANGED
@@ -29,3 +29,45 @@
|
|
29
29
|
driver.get("https://google.co.jp/")
|
30
30
|
|
31
31
|
```
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
```Python
|
36
|
+
|
37
|
+
from selenium import webdriver
|
38
|
+
|
39
|
+
import os
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
# To use Tor's SOCKS proxy server with chrome, include the socks protocol in the scheme with the --proxy-server option
|
44
|
+
|
45
|
+
# PROXY = "socks5://127.0.0.1:9150" # IP:PORT or HOST:PORT
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
torexe = os.popen(r'C:\Users\Owner\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe')
|
50
|
+
|
51
|
+
PROXY = "socks5://localhost:9050" # IP:PORT or HOST:PORT
|
52
|
+
|
53
|
+
options = webdriver.ChromeOptions()
|
54
|
+
|
55
|
+
#options.add_argument('--headless')
|
56
|
+
|
57
|
+
options.add_argument("start-maximized")
|
58
|
+
|
59
|
+
options.add_argument("disable-infobars")
|
60
|
+
|
61
|
+
options.add_argument("--disable-extensions")
|
62
|
+
|
63
|
+
options.add_argument('--proxy-server=%s' % PROXY)
|
64
|
+
|
65
|
+
driver = webdriver.Chrome(chrome_options=options, executable_path=r'/Users/xxx/chromedriver.exe')
|
66
|
+
|
67
|
+
driver.get("http://check.torproject.org")
|
68
|
+
|
69
|
+
driver.get("https://google.co.jp/")
|
70
|
+
|
71
|
+
print (driver.title)
|
72
|
+
|
73
|
+
```
|