Jared %!s(int64=3) %!d(string=hai) anos
pai
achega
bfcf523f45
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  1. 5 2
      hhh/SEO/fast_1999.py

+ 5 - 2
hhh/SEO/fast_1999.py

@@ -11,6 +11,7 @@ from selenium.webdriver.support.ui import WebDriverWait
 from selenium.webdriver.common.by import By
 from selenium.webdriver.support import expected_conditions as EC
 from userAgentRandomizer import userAgents
+from selenium.webdriver.chrome.options import Options
 import codecs
 import random
 import requests
@@ -100,13 +101,15 @@ def re_get_webdriver():
         ua = userAgents()
 
         user_agent = ua.random()        
-        options = webdriver.ChromeOptions()
+#        options = webdriver.ChromeOptions()
+        options = Options()
         # options.add_argument("--headless") # 視窗背後執行
         print(user_agent)
-        options.add_argument("user-agent=" +user_agent)
+        options.add_argument("--user-agent=" +user_agent)
 
         driver = webdriver.Remote(
             command_executor='http://127.0.0.1:'+str(portnum)+'/wd/hub'
+#            options=options
 #                        desired_capabilities=options.to_capabilities(),
             )
         driver.set_window_size(1400,1000)