|
@@ -241,9 +241,9 @@ class CreateAd:
|
|
|
|
|
|
if info['type'] == 'topImg':
|
|
|
single_page_set()
|
|
|
- if info['type'] == 'multi_page':
|
|
|
+ if info['type'] == 'topSlider':
|
|
|
multi_page_set()
|
|
|
- if info['type'] == 'movie':
|
|
|
+ if info['type'] == 'topVideo':
|
|
|
movie_set()
|
|
|
|
|
|
# 设置头部组件
|
|
@@ -410,100 +410,9 @@ class CreateAd:
|
|
|
distance_buttons_can_use[1].send_keys(Keys.BACKSPACE)
|
|
|
distance_buttons_can_use[1].send_keys(config_info['str_dimarginBottomstance'])
|
|
|
|
|
|
- def set_follow_button(self, button_type):
|
|
|
- # 设置关注按钮
|
|
|
- # 1.设置button文本内容2.是否加粗3.设置字体颜色,边框颜色,填充色4.设置边距
|
|
|
+ def set_follow_button(self, config_info):
|
|
|
+ # TODO:是否一键关注
|
|
|
|
|
|
- self.driver.find_element_by_xpath('//*[@id="stage-sidebar"]/section/div[4]/div[2]/div/div').click()
|
|
|
- if button_type == 1:
|
|
|
- input_elements = self.driver.find_elements_by_xpath('//input[@class="adui-input-base"]')
|
|
|
- for _ in input_elements:
|
|
|
- if _.is_enabled() and _.is_displayed() and _.get_attribute("value") == '关注公众号':
|
|
|
- _.click()
|
|
|
- _.clear()
|
|
|
- for i in range(10):
|
|
|
- _.send_keys(Keys.BACKSPACE)
|
|
|
- _.send_keys('保存阅读记录')
|
|
|
- big_elements = self.driver.find_elements_by_xpath('//span[@class="adui-button-content"]')
|
|
|
- for _ in big_elements:
|
|
|
- if _.text == '加粗' and _.is_displayed() and _.is_enabled():
|
|
|
- _.click()
|
|
|
- input_elements = self.driver.find_elements_by_xpath('//input[@class="adui-input-base"]')
|
|
|
- for _ in input_elements:
|
|
|
- if _.is_enabled() and _.is_displayed() and _.get_attribute("value") == '07C160':
|
|
|
- _.click()
|
|
|
- _.send_keys('DE2821')
|
|
|
- if button_type == 2:
|
|
|
- input_elements = self.driver.find_elements_by_xpath('//input[@class="adui-input-base"]')
|
|
|
- for _ in input_elements:
|
|
|
- if _.is_enabled() and _.is_displayed() and _.get_attribute("value") == '关注公众号':
|
|
|
- _.click()
|
|
|
- _.clear()
|
|
|
- for i in range(10):
|
|
|
- _.send_keys(Keys.BACKSPACE)
|
|
|
- _.send_keys('点击此处,继续阅读')
|
|
|
- big_elements = self.driver.find_elements_by_xpath('//span[@class="adui-button-content"]')
|
|
|
- for _ in big_elements:
|
|
|
- if _.text == '加粗' and _.is_displayed() and _.is_enabled():
|
|
|
- _.click()
|
|
|
- input_elements = self.driver.find_elements_by_xpath('//input[@class="adui-input-base"]')
|
|
|
- for _ in input_elements:
|
|
|
- if _.is_enabled() and _.is_displayed() and _.get_attribute("value") == '07C160':
|
|
|
- _.click()
|
|
|
- _.send_keys('DE2821')
|
|
|
- size_buttons = self.driver.find_elements_by_xpath('//input[@class="adui-input-base"]')
|
|
|
- size_buttons_can_use = []
|
|
|
- for _ in size_buttons:
|
|
|
- if _.is_enabled() and _.is_displayed() and _.get_attribute("value") == '28':
|
|
|
- size_buttons_can_use.append(_)
|
|
|
- size_buttons_can_use[0].click()
|
|
|
- for i in range(4):
|
|
|
- size_buttons_can_use[0].send_keys(Keys.BACKSPACE)
|
|
|
- size_buttons_can_use[0].send_keys('0')
|
|
|
- size_buttons_can_use[1].click()
|
|
|
- for i in range(4):
|
|
|
- size_buttons_can_use[1].send_keys(Keys.BACKSPACE)
|
|
|
- size_buttons_can_use[1].send_keys('0')
|
|
|
-
|
|
|
- if button_type == 3:
|
|
|
- input_elements = self.driver.find_elements_by_xpath('//input[@class="adui-input-base"]')
|
|
|
- for _ in input_elements:
|
|
|
- if _.is_enabled() and _.is_displayed() and _.get_attribute("value") == '关注公众号':
|
|
|
- _.click()
|
|
|
- _.clear()
|
|
|
- for i in range(10):
|
|
|
- _.send_keys(Keys.BACKSPACE)
|
|
|
- _.send_keys('点我,继续阅读')
|
|
|
- big_elements = self.driver.find_elements_by_xpath('//span[@class="adui-button-content"]')
|
|
|
- for _ in big_elements:
|
|
|
- if _.text == '加粗' and _.is_displayed() and _.is_enabled():
|
|
|
- _.click()
|
|
|
- input_elements = self.driver.find_elements_by_xpath('//input[@class="adui-input-base"]')
|
|
|
- for _ in input_elements:
|
|
|
- if _.is_enabled() and _.is_displayed() and _.get_attribute("value") == '07C160':
|
|
|
- _.click()
|
|
|
- _.send_keys('FFFFFF')
|
|
|
- input_elements = self.driver.find_elements_by_xpath('//input[@class="adui-input-base"]')
|
|
|
- for _ in input_elements:
|
|
|
- if _.is_enabled() and _.is_displayed() and _.get_attribute("value") == 'FFFFFF':
|
|
|
- _.click()
|
|
|
- _.send_keys('DE2821')
|
|
|
- break
|
|
|
- size_buttons = self.driver.find_elements_by_xpath('//input[@class="adui-input-base"]')
|
|
|
- size_buttons_can_use = []
|
|
|
- for _ in size_buttons:
|
|
|
- if _.is_enabled() and _.is_displayed() and _.get_attribute("value") == '28':
|
|
|
- size_buttons_can_use.append(_)
|
|
|
- size_buttons_can_use[0].click()
|
|
|
- for i in range(4):
|
|
|
- size_buttons_can_use[0].send_keys(Keys.BACKSPACE)
|
|
|
- size_buttons_can_use[0].send_keys('0')
|
|
|
- size_buttons_can_use[1].click()
|
|
|
- for i in range(4):
|
|
|
- size_buttons_can_use[1].send_keys(Keys.BACKSPACE)
|
|
|
- size_buttons_can_use[1].send_keys('100')
|
|
|
-
|
|
|
- def set_follow_button_(self, config_info):
|
|
|
# 设置关注按钮
|
|
|
# 1.设置button文本内容 2.是否加粗 3.设置字体颜色,边框颜色,填充色 4.设置边距
|
|
|
|
|
@@ -662,6 +571,7 @@ class CreateAd:
|
|
|
for _ in v:
|
|
|
if isinstance(_, dict):
|
|
|
get_url(_)
|
|
|
+
|
|
|
# 上传文件,单线程
|
|
|
# 上传文件,文件上传与整体流程切割开
|
|
|
WebDriverWait(self.driver, 10).until(
|
|
@@ -685,7 +595,6 @@ class CreateAd:
|
|
|
# else:
|
|
|
# file_set.add(v[v_name])
|
|
|
|
|
|
-
|
|
|
get_url(layout)
|
|
|
for _ in file_set:
|
|
|
self.send_file(_)
|
|
@@ -760,7 +669,7 @@ class CreateAd:
|
|
|
if _['type'] == 'txt':
|
|
|
self.set_content(_['content'])
|
|
|
if _['type'] == 'followAcc':
|
|
|
- self.set_follow_button_(_['content'])
|
|
|
+ self.set_follow_button(_['content'])
|
|
|
|
|
|
self.set_share_content(title_content=layout['shareTittle'], des_content=layout['shareDesc'])
|
|
|
|