I am trying to click through a form on https://www.autozone.com
from selenium import webdriver
from selenium.webdriver import DesiredCapabilities
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
URL = "https://www.autozone.com/"
caps = DesiredCapabilities().CHROME
caps["pageLoadStrategy"] = "eager"
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
waitDriver = WebDriverWait(driver, 10)
driver.get(URL)
add_vehicle_button = waitDriver.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button[data-testid='deskTopVehicle-menu-lg']")))
add_vehicle_button.click()
waitDriver.until(EC.element_to_be_clickable((By.ID, "yearheader"))).click()
year_button = waitDriver.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button[data-testid='yearheader-dropdown-list-item-1']")))
year_button.click()
waitDriver.until(EC.element_to_be_clickable((By.ID, "makeheader"))).click()
make_button = waitDriver.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button[data-testid='makeheader-dropdown-list-item-1']")))
make_button.click()
When running the program after year_button.click() a browser error is thrown and the popup disappears
framework-92798cb7dae0e0c5.js:10 TypeError: Cannot read properties of null (reading 'title')
at ag (1479-2923fb31debee947.js:1:20112)
at fs (framework-92798cb7dae0e0c5.js:10:59098)
at f1 (framework-92798cb7dae0e0c5.js:10:68616)
at i (framework-92798cb7dae0e0c5.js:10:112207)
at hr (framework-92798cb7dae0e0c5.js:10:98463)
at hp (framework-92798cb7dae0e0c5.js:10:98391)
at ho (framework-92798cb7dae0e0c5.js:10:98254)
at hg (framework-92798cb7dae0e0c5.js:10:95233)
at framework-92798cb7dae0e0c5.js:10:45040
at b.unstable_runWithPriority (framework-92798cb7dae0e0c5.js:24:9736)
gi @ framework-92798cb7dae0e0c5.js:10
f.componentDidCatch.c.callback @ framework-92798cb7dae0e0c5.js:10
eK @ framework-92798cb7dae0e0c5.js:10
gp @ framework-92798cb7dae0e0c5.js:10
hu @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
ht @ framework-92798cb7dae0e0c5.js:10
hg @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
er @ framework-92798cb7dae0e0c5.js:10
eq @ framework-92798cb7dae0e0c5.js:10
aM @ framework-92798cb7dae0e0c5.js:10
bR @ framework-92798cb7dae0e0c5.js:10
main-3fe83d5d1863abe4.js:1 GET https://www.autozone.com/images/icon-store-selected-t.svg 403
(anonymous) @ main-3fe83d5d1863abe4.js:1
f @ main-3fe83d5d1863abe4.js:1
(anonymous) @ main-3fe83d5d1863abe4.js:1
updateHead @ main-3fe83d5d1863abe4.js:1
h @ main-3fe83d5d1863abe4.js:1
(anonymous) @ main-3fe83d5d1863abe4.js:1
hz @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
hw @ framework-92798cb7dae0e0c5.js:10
hg @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
er @ framework-92798cb7dae0e0c5.js:10
eq @ framework-92798cb7dae0e0c5.js:10
aM @ framework-92798cb7dae0e0c5.js:10
bR @ framework-92798cb7dae0e0c5.js:10
icon-oops.svg:1 GET https://www.autozone.com/images/icon-oops.svg 403
Image (async)
A @ framework-92798cb7dae0e0c5.js:10
gf @ framework-92798cb7dae0e0c5.js:10
hs @ framework-92798cb7dae0e0c5.js:10
hr @ framework-92798cb7dae0e0c5.js:10
hp @ framework-92798cb7dae0e0c5.js:10
ho @ framework-92798cb7dae0e0c5.js:10
hg @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
er @ framework-92798cb7dae0e0c5.js:10
eq @ framework-92798cb7dae0e0c5.js:10
aM @ framework-92798cb7dae0e0c5.js:10
bR @ framework-92798cb7dae0e0c5.js:10
az_locator.svg:1 GET https://www.autozone.com/cdn/icons/az_icons/az_locator.svg 403
Image (async)
A @ framework-92798cb7dae0e0c5.js:10
gy @ framework-92798cb7dae0e0c5.js:10
hu @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
ht @ framework-92798cb7dae0e0c5.js:10
hg @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
er @ framework-92798cb7dae0e0c5.js:10
eq @ framework-92798cb7dae0e0c5.js:10
hb @ framework-92798cb7dae0e0c5.js:10
fQ @ framework-92798cb7dae0e0c5.js:10
m.tagName.j.current.g.root @ _app-1cb58c4ab13ffd1d.js:47
(anonymous) @ _app-1cb58c4ab13ffd1d.js:47
(anonymous) @ _app-1cb58c4ab13ffd1d.js:47
az-box.svg:1 GET https://www.autozone.com/images/footer/az-box.svg 403
Image (async)
A @ framework-92798cb7dae0e0c5.js:10
gy @ framework-92798cb7dae0e0c5.js:10
hu @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
ht @ framework-92798cb7dae0e0c5.js:10
hg @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
er @ framework-92798cb7dae0e0c5.js:10
eq @ framework-92798cb7dae0e0c5.js:10
hb @ framework-92798cb7dae0e0c5.js:10
fQ @ framework-92798cb7dae0e0c5.js:10
m.tagName.j.current.g.root @ _app-1cb58c4ab13ffd1d.js:47
(anonymous) @ _app-1cb58c4ab13ffd1d.js:47
(anonymous) @ _app-1cb58c4ab13ffd1d.js:47
az-compose.svg:1 GET https://www.autozone.com/images/footer/az-compose.svg 403
Image (async)
A @ framework-92798cb7dae0e0c5.js:10
gy @ framework-92798cb7dae0e0c5.js:10
hu @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
ht @ framework-92798cb7dae0e0c5.js:10
hg @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
er @ framework-92798cb7dae0e0c5.js:10
eq @ framework-92798cb7dae0e0c5.js:10
hb @ framework-92798cb7dae0e0c5.js:10
fQ @ framework-92798cb7dae0e0c5.js:10
m.tagName.j.current.g.root @ _app-1cb58c4ab13ffd1d.js:47
(anonymous) @ _app-1cb58c4ab13ffd1d.js:47
(anonymous) @ _app-1cb58c4ab13ffd1d.js:47
new-facebook.svg:1 GET https://www.autozone.com/images/socialmedia/new-facebook.svg 403
Image (async)
A @ framework-92798cb7dae0e0c5.js:10
gy @ framework-92798cb7dae0e0c5.js:10
hu @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
ht @ framework-92798cb7dae0e0c5.js:10
hg @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
er @ framework-92798cb7dae0e0c5.js:10
eq @ framework-92798cb7dae0e0c5.js:10
hb @ framework-92798cb7dae0e0c5.js:10
fQ @ framework-92798cb7dae0e0c5.js:10
m.tagName.j.current.g.root @ _app-1cb58c4ab13ffd1d.js:47
(anonymous) @ _app-1cb58c4ab13ffd1d.js:47
(anonymous) @ _app-1cb58c4ab13ffd1d.js:47
new-twitter.svg:1 GET https://www.autozone.com/images/socialmedia/new-twitter.svg 403
Image (async)
A @ framework-92798cb7dae0e0c5.js:10
gy @ framework-92798cb7dae0e0c5.js:10
hu @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
ht @ framework-92798cb7dae0e0c5.js:10
hg @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
er @ framework-92798cb7dae0e0c5.js:10
eq @ framework-92798cb7dae0e0c5.js:10
hb @ framework-92798cb7dae0e0c5.js:10
fQ @ framework-92798cb7dae0e0c5.js:10
m.tagName.j.current.g.root @ _app-1cb58c4ab13ffd1d.js:47
(anonymous) @ _app-1cb58c4ab13ffd1d.js:47
(anonymous) @ _app-1cb58c4ab13ffd1d.js:47
new-you-tube.svg:1 GET https://www.autozone.com/images/socialmedia/new-you-tube.svg 403
Image (async)
A @ framework-92798cb7dae0e0c5.js:10
gy @ framework-92798cb7dae0e0c5.js:10
hu @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
ht @ framework-92798cb7dae0e0c5.js:10
hg @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
er @ framework-92798cb7dae0e0c5.js:10
eq @ framework-92798cb7dae0e0c5.js:10
hb @ framework-92798cb7dae0e0c5.js:10
fQ @ framework-92798cb7dae0e0c5.js:10
m.tagName.j.current.g.root @ _app-1cb58c4ab13ffd1d.js:47
(anonymous) @ _app-1cb58c4ab13ffd1d.js:47
(anonymous) @ _app-1cb58c4ab13ffd1d.js:47
new-Instagram.svg:1 GET https://www.autozone.com/images/socialmedia/new-Instagram.svg 403
Image (async)
A @ framework-92798cb7dae0e0c5.js:10
gy @ framework-92798cb7dae0e0c5.js:10
hu @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
ht @ framework-92798cb7dae0e0c5.js:10
hg @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
eo @ framework-92798cb7dae0e0c5.js:10
er @ framework-92798cb7dae0e0c5.js:10
eq @ framework-92798cb7dae0e0c5.js:10
hb @ framework-92798cb7dae0e0c5.js:10
fQ @ framework-92798cb7dae0e0c5.js:10
m.tagName.j.current.g.root @ _app-1cb58c4ab13ffd1d.js:47
(anonymous) @ _app-1cb58c4ab13ffd1d.js:47
(anonymous) @ _app-1cb58c4ab13ffd1d.js:47
main-3fe83d5d1863abe4.js:1 GET https://www.autozone.com/_next/static/chunks/6408-1bd3c80aa85d4b2d.js net::ERR_ABORTED 403
document.querySelector.c.set.e @ main-3fe83d5d1863abe4.js:1
k @ main-3fe83d5d1863abe4.js:1
(anonymous) @ main-3fe83d5d1863abe4.js:1
Promise.then (async)
(anonymous) @ main-3fe83d5d1863abe4.js:1
f @ main-3fe83d5d1863abe4.js:1
loadRoute @ main-3fe83d5d1863abe4.js:1
loadPage @ main-3fe83d5d1863abe4.js:1
(anonymous) @ main-3fe83d5d1863abe4.js:1
c @ main-3fe83d5d1863abe4.js:1
h @ main-3fe83d5d1863abe4.js:1
Promise.then (async)
c @ main-3fe83d5d1863abe4.js:1
h @ main-3fe83d5d1863abe4.js:1
Promise.then (async)
c @ main-3fe83d5d1863abe4.js:1
h @ main-3fe83d5d1863abe4.js:1
Promise.then (async)
c @ main-3fe83d5d1863abe4.js:1
h @ main-3fe83d5d1863abe4.js:1
Promise.then (async)
c @ main-3fe83d5d1863abe4.js:1
h @ main-3fe83d5d1863abe4.js:1
(anonymous) @ main-3fe83d5d1863abe4.js:1
(anonymous) @ main-3fe83d5d1863abe4.js:1
prefetch @ main-3fe83d5d1863abe4.js:1
c.<computed> @ main-3fe83d5d1863abe4.js:1
p @ _app-1cb58c4ab13ffd1d.js:47
onMouseEnter @ _app-1cb58c4ab13ffd1d.js:47
aW @ framework-92798cb7dae0e0c5.js:10
a0 @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
df @ framework-92798cb7dae0e0c5.js:10
dg @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
aO @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
dm @ framework-92798cb7dae0e0c5.js:10
bU @ framework-92798cb7dae0e0c5.js:10
bT @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
bS @ framework-92798cb7dae0e0c5.js:10
main-3fe83d5d1863abe4.js:1 GET https://www.autozone.com/_next/static/chunks/pages/trackOrder-659e75ad60d846ea.js net::ERR_ABORTED 403
document.querySelector.c.set.e @ main-3fe83d5d1863abe4.js:1
k @ main-3fe83d5d1863abe4.js:1
(anonymous) @ main-3fe83d5d1863abe4.js:1
Promise.then (async)
(anonymous) @ main-3fe83d5d1863abe4.js:1
f @ main-3fe83d5d1863abe4.js:1
loadRoute @ main-3fe83d5d1863abe4.js:1
loadPage @ main-3fe83d5d1863abe4.js:1
(anonymous) @ main-3fe83d5d1863abe4.js:1
c @ main-3fe83d5d1863abe4.js:1
h @ main-3fe83d5d1863abe4.js:1
Promise.then (async)
c @ main-3fe83d5d1863abe4.js:1
h @ main-3fe83d5d1863abe4.js:1
Promise.then (async)
c @ main-3fe83d5d1863abe4.js:1
h @ main-3fe83d5d1863abe4.js:1
Promise.then (async)
c @ main-3fe83d5d1863abe4.js:1
h @ main-3fe83d5d1863abe4.js:1
Promise.then (async)
c @ main-3fe83d5d1863abe4.js:1
h @ main-3fe83d5d1863abe4.js:1
(anonymous) @ main-3fe83d5d1863abe4.js:1
(anonymous) @ main-3fe83d5d1863abe4.js:1
prefetch @ main-3fe83d5d1863abe4.js:1
c.<computed> @ main-3fe83d5d1863abe4.js:1
p @ _app-1cb58c4ab13ffd1d.js:47
onMouseEnter @ _app-1cb58c4ab13ffd1d.js:47
aW @ framework-92798cb7dae0e0c5.js:10
a0 @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
df @ framework-92798cb7dae0e0c5.js:10
dg @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
aO @ framework-92798cb7dae0e0c5.js:10
(anonymous) @ framework-92798cb7dae0e0c5.js:10
dm @ framework-92798cb7dae0e0c5.js:10
bU @ framework-92798cb7dae0e0c5.js:10
bT @ framework-92798cb7dae0e0c5.js:10
b.unstable_runWithPriority @ framework-92798cb7dae0e0c5.js:24
bS @ framework-92798cb7dae0e0c5.js:10
ruxitagentjs_A27Vfghjqrux_10249220905100923.js:195 GET https://www.autozone.com/_next/static/css/d7f6188d9650e1ef.css 403
This does not happen when I click through the form manually in a browser.
I have no idea why an error would be thrown with the webdriver but not when clicking manually. How can I get to the root problem and fix it?
Update 10/2/2022
I have tried the same code with firefox, and remade the code with the java selenium library with chrome and firefox. Same error, "T.error is null"
CodePudding user response:
Somehow it is working on my end if I add the following lines at the top:
options = webdriver.ChromeOptions()
options.add_argument('--disable-blink-features=AutomationControlled')
Also, you need to adjust the line where you instantiate the driver:
driver = webdriver.Chrome(options=options, service=Service(ChromeDriverManager().install()))