|
@@ -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):
|