import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
import autoit
wait = WebDriverWait
firefox_options = webdriver.FirefoxOptions()
firefox_options.set_preference("dom.webnotifications.enabled", False)
driver = webdriver.Firefox(firefox_options=firefox_options, executable_path=r'C:\\firefoxdriver\\geckodriver.exe')
driver.maximize_window()
driver.get("http://www.demo.guru99.com/V4/")
driver.find_element_by_xpath('/html/body/form/table/tbody/tr[1]/td[2]/input').send_keys('mngr253724')
driver.find_element_by_xpath('/html/body/form/table/tbody/tr[2]/td[2]/input').send_keys('Et54Uje')
driver.find_element_by_xpath('/html/body/form/table/tbody/tr[3]/td[2]/input[1]').click()
time.sleep(5)
try:
page_loaded = wait.until_not(
lambda driver: driver.current_url == "http://www.demo.guru99.com/V4/manager/Managerhomepage.php"
)
except TimeoutException:
driver.fail("Loading timeout expired")
driver.assertEqual(
driver.current_url,
correct_page,
msg="Successful Login"
)
错误:
File "C:/Users/Dell/PycharmProjects/Test_Order/Test_Order.py", line 27, in <module>
lambda driver: driver.current_url == "http://www.demo.guru99.com/V4/manager/Managerhomepage.php"
TypeError: until_not() missing 1 required positional argument: 'method'