Commit a3d90735 authored by gaotao's avatar gaotao

修改打开网页方法

parent 126e1fbd
...@@ -19,7 +19,7 @@ class BrowserEngine(ReadConfig): ...@@ -19,7 +19,7 @@ class BrowserEngine(ReadConfig):
self.driver = webdriver.Chrome(self._driver_path) self.driver = webdriver.Chrome(self._driver_path)
self.open_browser() self.open_browser()
self.login_znfz() self.login_znfz()
self.get_page() self.format_url()
self.driver.xpath = self.driver.find_elements_by_xpath self.driver.xpath = self.driver.find_elements_by_xpath
def open_browser(self): def open_browser(self):
...@@ -68,13 +68,17 @@ class BrowserEngine(ReadConfig): ...@@ -68,13 +68,17 @@ class BrowserEngine(ReadConfig):
self.driver.find_element_by_xpath('//*[@id="root"]/div/div/div[2]/form/div[4]/div/div/span/button').click() self.driver.find_element_by_xpath('//*[@id="root"]/div/div/div[2]/form/div[4]/div/div/span/button').click()
return self.driver return self.driver
def get_page(self): def format_url(self):
time.sleep(1)
if self.url in ['LOGIN', 'INDEX']:
return
if self.url != 'URL':
url = self.get_testUrl(self.url) url = self.get_testUrl(self.url)
url = url.format(bmsah=self.get_caseId('caseId')) if '{' in url else url if '{' in url:
self.daoqiezui_url = url.format(bmsah=self.get_caseId('caseId_dqz'),ysay='盗窃罪')
self.guyishanghaizui_url = url.format(bmsah=self.get_caseId('caseId_gyshz'),ysay='故意伤害罪')
self.DQZ = self.daoqiezui_url
self.GYSHZ = self.guyishanghaizui_url
def get_page(self,url):
self.logger.info("the testUrl : %s" % url) self.logger.info("the testUrl : %s" % url)
self.driver.get(url) self.driver.get(url)
......
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