lundi 9 septembre 2019

Redeclared 'button' defined above without usage

I try to automate testing of an Internet site in Pycharm. There is a warning in line 15: “Redeclared 'button' defined above without usage”. What does it mean? (It is the same story with "choices")

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome(executable_path=r'C:\TestFiles\chromedriver.exe')

locator = (By.ID, "guestname")
locator_css = (By.CSS_SELECTOR, "#guestname")
guest_input = driver.find_element(*locator)

guest_input.send_keys("Marcin Pilzak")

locator2 = (By.CSS_SELECTOR, "button.MuiButton-containedPrimary")
button = driver.find_element(*locator2)

(LINE 15) button = driver.find_element_by_css_selector("button.MuiButton-containedPrimary")

button.click()

locator2 = (By.CSS_SELECTOR, "__button")
button = driver.find_element(*locator2)

button = driver.find_element_by_css_selector("__button")
.
button.click()

choices = driver.find_elements_by_xpath("//div[contains('name') and contains(@class, '__input')]".sendKeys("UserName"))

choices = driver.find_elements_by_xpath("//div[contains('email') and contains(@class, '__input')]".sendKeys("Email"))

choices = driver.find_elements_by_xpath("//div[contains('phone') and contains(@class, '__input')]".sendKeys("Phone"))

Aucun commentaire:

Enregistrer un commentaire