Commit 34eb9bf2 authored by liyang's avatar liyang

feat:手动配置firefox驱动程序

parent ce3e60b8
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -112,7 +112,21 @@ def create(option=None, no_headless=False, using_user_data=True, web_browser="fi
# 当然也可以通过 executable_path 自定义
if web_browser == "firefox":
# 创建Firefox浏览器对象并传入选
browser = webdriver.Firefox(options=options, service=FirefoxService(GeckoDriverManager().install()))
if platform.system() == "Windows":
service = FirefoxService(
executable_path=os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser', "web-driver",
"firefox", "windows",
"geckodriver.exe"))
browser = webdriver.Firefox(options=options, service=service)
elif platform.system() == "Linux":
service = FirefoxService(executable_path=os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser',"web-driver","firefox","linux",
"geckodriver"))
browser = webdriver.Firefox(options=options, service=service)
elif platform.system() == "Darwin":
service = FirefoxService(executable_path=os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser',"web-driver","firefox","mac",
"geckodriver"))
browser = webdriver.Firefox(options=options, service=service)
elif web_browser == "chrome":
# 创建Chrome浏览器对象并传入选项
web_browser = webdriver.Chrome(options=options, service=ChromeService(ChromeDriverManager().install()))
......
......@@ -20,11 +20,11 @@ class HttpRequest:
if self.method.lower() == "post":
# if self.headers is None:
# self.headers = {"Content-Type": "application/json;charset=UTF-8s"}
return requests.post(self.url, self.param,headers=self.headers, cookies=self.cookie)
return requests.post(self.url, self.param,headers=self.headers, cookies=self.cookie,verify=False)
elif self.method.lower() == "get":
if self.headers is None:
self.headers = {"Content-Type": "application/json;charset=UTF-8s"}
return requests.get(self.url, self.param, headers=self.headers, cookies=self.cookie)
return requests.get(self.url, self.param, headers=self.headers, cookies=self.cookie,verify=False)
else:
print("请求方式错误:{0}".format(self.method))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment