kellywu
(wr)
1
在进行企业微信实战时遇到二个问题
1、self.find(By.ID,“menu_index”).click(),脚本中要定位到首页并点击,实际执行时才能跳转到通讯录TAB页
2、以下二处执行点击操作后,页面不会跳转(试过隐式等待和显示等待)
引用
def contacts(self):
def wait_for_addmem(x):
elements_len=len(self.finds(By.CSS_SELECTOR,"#username"))
if elements_len<=0:
self.find(By.CSS_SELECTOR, “.ww_operationBar .js_add_member”).click()
return elements_len>0
self.wait_for_click(wait_for_addmem)
return AddMember(self._driver)
self.find(By.CSS_SELECTOR,’.js_btn_save’).click()
kellywu
(wr)
4
也试过死等sleep(10)
‘’'python
def contacts(self):
def wait_for_addmem(x):
elements_len=len(self.finds(By.CSS_SELECTOR,"#username"))
if elements_len<=0:
self.find(By.CSS_SELECTOR, ".ww_operationBar .js_add_member").click()#页面没跳转
return elements_len>0
self.wait_for_click(wait_for_addmem)
return AddMember(self._driver)
def add_member(self):
#self.wait_for(By.ID,"username")
self.find(By.ID,"username").send_keys("abcde")
self.find(By.ID,"memberAdd_acctid").send_keys("abcdefadbco")
self.find(By.ID,"memberAdd_phone").send_keys("18122222222")
self.find(By.CSS_SELECTOR,'.js_btn_save').click()#没保存成功
sleep(5)
‘’’
_AD
(霍格沃兹_AD)
5
格式化是反引号不是引号
你既然是点击失效的话,那死等放在点击之前,你放点击之后干嘛呀
kellywu
(wr)
7
找到原因了,把浏览器页面大小恢复成100%就不再出现以上二个问题