1. 执行下面代码,火狐没有抛出验证错误
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By driver = webdriver.Chrome() driver.get("http://www.python.org") print(driver.title) assert "Python" in driver.title elem = driver.find_element(By.NAME, "q") elem.clear() elem.send_keys("pyconssssss") elem.send_keys(Keys.RETURN) print(driver.page_source) assert "No results found." not in driver.page_source
应该像chrome中一样:
Traceback (most recent call last):
File "D:/PycharmProjects/pythonProject/python_org_search.py", line 15, in <module>
assert "No results found." not in driver.page_source
AssertionError