noodles hace 1 año
padre
commit
ae36993456
Se han modificado 1 ficheros con 12 adiciones y 23 borrados
  1. 12 23
      utility.py

+ 12 - 23
utility.py

@@ -5,33 +5,22 @@ from selenium import webdriver
 from selenium.webdriver.common.action_chains import ActionChains
 from selenium.webdriver.common.keys import Keys
 
-from seleniumwire import webdriver
-from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
+#from seleniumwire import webdriver
+#from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
 import time
 
 
-def brower_start(port, proxyport, chrome_window):
-    print(proxyport)
+
+def brower_start(port):
     options = webdriver.ChromeOptions()
-    if chrome_window:
-        browser = webdriver.Chrome(
-            desired_capabilities=options.to_capabilities()
-        )
-    else:
-        chrome_options = webdriver.ChromeOptions()
-        chrome_options.add_argument('--proxy-server=host.docker.internal:'+str(proxyport))  # Specify your Kubernetes service-name here
-        chrome_options.add_argument('--ignore-certificate-errors')
-        chrome_options.add_argument("--no-sandbox")
-        chrome_options.add_argument("--disable-dev-shm-usage")
-        browser = webdriver.Remote(
-            command_executor='http://127.0.0.1:'+str(port)+'/wd/hub',
-            desired_capabilities=chrome_options.to_capabilities(),
-            seleniumwire_options={'addr':'0.0.0.0','port':proxyport,'auto_config': False}
-
-            )
-#            seleniumwire_options = {'addr': '172.17.0.2','port':4444})
-        browser.set_window_size(1400,1000)
-    return browse
+
+#    browser = webdriver.Chrome(options=options)
+#    上面成功再來用docker
+    browser = webdriver.Remote(
+        command_executor='http://127.0.0.1:'+str(port)+'/wd/hub',
+        desired_capabilities=options.to_capabilities()
+    )
+    return browser
 
 
 def brower_start2(port):