|
@@ -51,28 +51,47 @@ def build_cache(db):
|
|
|
return id_dict
|
|
|
|
|
|
|
|
|
+#def brower_start(port):
|
|
|
+# global proxyport
|
|
|
+# global chrome_window
|
|
|
+# print(proxyport)
|
|
|
+# 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}
|
|
|
+
|
|
|
+# )
|
|
|
+# browser.set_window_size(1400,1000)
|
|
|
+# return browser
|
|
|
+
|
|
|
def brower_start(port):
|
|
|
- global proxyport
|
|
|
- global chrome_window
|
|
|
- print(proxyport)
|
|
|
+
|
|
|
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}
|
|
|
-
|
|
|
- )
|
|
|
- browser.set_window_size(1400,1000)
|
|
|
+# browser = webdriver.Chrome(options=options)
|
|
|
+ options.add_argument('--ignore-certificate-errors')
|
|
|
+ options.add_argument("--no-sandbox")
|
|
|
+ options.add_argument("--headless")
|
|
|
+ options.add_argument("--disable-gpu")
|
|
|
+ options.add_argument("--disable-dev-shm-usage")
|
|
|
+ browser = webdriver.Chrome(options=options)
|
|
|
+ browser.set_window_size(1400,1000)
|
|
|
+
|
|
|
+# browser = webdriver.Remote(
|
|
|
+# command_executor='http://127.0.0.1:'+str(port)+'/wd/hub',
|
|
|
+# # command_executor='http://192.53.174.202:'+str(port)+'/wd/hub',
|
|
|
+# desired_capabilities=options.to_capabilities()
|
|
|
+# )
|
|
|
return browser
|
|
|
|
|
|
|