selenum的代码如下:
import pytest
from selenium import webdriver
from selenium import webdriver
from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By
from time import sleep
class Test_错误的登录:
def test_UI_0001(self):
print('\n用例UI_0001')
driver = webdriver.Chrome()
driver.implicitly_wait(10)
driver.get("http://127.0.0.1/mgr/index.html")
# driver.find_element(By.ID, 'username').send_keys('')
sleep(3)
driver.find_element(By.ID, 'password').send_keys('88888888')
sleep(3)
driver.find_element(By.CSS_SELECTOR, 'button[type="submit"]').click()
sleep(2)
alertText = driver.switch_to.alert.text
print(alertText)
assert alertText == '请输入用户名'
执行报错:文章来源:https://www.toymoban.com/news/detail-629355.html
python中selenium执行报错:response = {‘status‘: 500, ‘value‘: ‘{“value“:{“data“:{“text“:“HTTP 错误 : 302Found文章来源地址https://www.toymoban.com/news/detail-629355.html
====================================================================== test session starts ======================================================================
platform win32 -- Python 3.8.3, pytest-5.4.3, py-1.9.0, pluggy-0.13.1 -- E:\tools\Andconda\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.8.3', 'Platform': 'Windows-10-10.0.19041-SP0', 'Packages': {'pytest': '5.4.3', 'py': '1.9.0', 'pluggy': '0.13.1'}, 'Plugins': {'html': '3.
1.1', 'metadata': '2.0.1', 'Faker': '13.3.4'}, 'JAVA_HOME': 'E:\\tools\\Java\\jdk1.8.0_201'}
rootdir: E:\12Python自动化测试\白月黑羽\自动化测试\UI_pytest
plugins: html-3.1.1, metadata-2.0.1, Faker-13.3.4
collected 4 items
cases/登录/test_错误登录.py::Test_错误密码::test_C001001
#### 初始化-目录甲
*** 初始化-模块 ***
=== 初始化-类 ===
--- 初始化-方法 ---
用例C001001
PASSED
--- 清除 -方法 ---
cases/登录/test_错误登录.py::Test_错误密码::test_C001002
--- 初始化-方法 ---
用例C001002
PASSED
--- 清除 -方法 ---
cases/登录/test_错误登录.py::Test_错误密码::test_C001003
--- 初始化-方法 ---
用例C001003
FAILED
--- 清除 -方法 ---
=== 清除 - 类 ===
到了这里,关于selenium执行报错:response = {‘status‘: 500, ‘value‘: ‘{“value“:{“data“:{“text“:“HTTP 错误 : 302Foun的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!