test_selenium.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:varapp-backend-py 作者: varapp 项目源码 文件源码
def try_login(self, until=1):
        """Fill in the login form and submit. If the login panel is
            not found, chack that we are already logged in."""
        if self.exists('#login', until):
            self.wait(EC.presence_of_element_located((By.NAME, 'username')), 2)
            username_input = self.driver.find_element_by_name('username')
            password_input = self.driver.find_element_by_name('password')
            submit_button = self.driver.find_element_by_class_name('submit-button')
            username_input.clear()
            password_input.clear()
            username_input.send_keys('test')
            password_input.send_keys('test')
            submit_button.click()
            return 1
        else:
            return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号