Пример почтового индекса помещается в поле ввода, но я просто не смог это сделать отправьте заявку!
Вот код, который у меня есть, и веб-сайт
Код: Выделить всё
# Import required modules
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSoup
import codecs
import re
driver=webdriver.Firefox()
zipcode_input = "35404"
#Redirect
val = 'https://www.americanstandardair.com/find-your-dealer/'
wait = WebDriverWait(driver, 10)
driver.get(val)
wait.until(EC.url_to_be(val))
page_source = driver.page_source
#waiting until input box is there then typing zipcode
send_keys = WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.ID, 'zipcode'))).send_keys(zipcode_input)
#waiting until submit button is there then submitting
submit_zipcode = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR('button[data-cy="zipcode-search"]'))))
submit_zipcode.click()
soup = BeautifulSoup(page_source,features="html.parser")
print("complete")
driver.quit()
Код: Выделить всё
TypeError: 'str' object is not callableЯ новичок в Python, поэтому я очень озадачен тем, что не так, поэтому буду признателен за любую помощь.< /п>
Подробнее здесь: https://stackoverflow.com/questions/786 ... d-selenium