使用selenium在web 版企业微信上面创建部门,无法正常选择所属部门
def addParty(self):
self._driver.find_element(By.XPATH, '//*[@class="member_colLeft_top_addBtn"]').click()
self._driver.find_element(By.CSS_SELECTOR, '.js_create_party').click()
self._driver.find_element(By.CSS_SELECTOR, '[name=name]').send_keys('质量管理部')
#点击所属部门 选择列表
self._driver.find_element(By.CSS_SELECTOR,'.js_parent_party_name').click()
#点击 研发中心
self._driver.find_element(By.XPATH,"//*[@id='1688853331729457_anchor']").click()
# self._driver.execute_script("document.getElementById('1688853331729457_anchor').click()")
# parentParty = self._driver.find_element(By.CSS_SELECTOR,'qui_dialog_body.ww_dialog_body[id="1688853331729457_anchor"]')
# webdriver.ActionChains(self._driver).move_to_element(parentParty).click(parentParty).perform()
self._driver.find_element(By.CSS_SELECTOR,'[id=__dialog__MNDialog__] div>div>a:nth-child(1)').click()
FAILED [100%]
test_contacts.py:42 (TestContact.test_addParty)
self = <workWeiXinMain.test_case.test_contacts.TestContact object at 0x7f9dcac48460>def test_addParty(self):
self.contactsPage.addParty()
test_contacts.py:44:
…/page/contacts.py:75: in addParty
self._driver.find_element(By.XPATH,"//*[@id=‘1688853331729457_anchor’]").click()
…/…/nvenv/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py:80: in click
self._execute(Command.CLICK_ELEMENT)
…/…/nvenv/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py:633: in _execute
return self._parent.execute(command, params)
…/…/nvenv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f9dcac33be0>
response = {‘status’: 400, ‘value’: ‘{“value”:{“error”:“element click intercepted”,“message”:“element click intercepted: Element …fff6aa95109 _pthread_start + 148\n24 libsystem_pthread.dylib 0x00007fff6aa90b8b thread_start + 15\n”}}’}