-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Labels
I-questionApplied to questions. Issues should be closed and send the user to community resources.Applied to questions. Issues should be closed and send the user to community resources.
Description
What happened?
I try to automate a court booking procedure and when I have automated the login action.
I try to navigate the driver to a new site that will help me to go to the booking site.
It can get to the desired URL if there is no more action after driver.get(URL) and yet,
When I add action to click the button after driver.get(URL) the script will return to the login page after driver.get(URL) and the address bar poped up the URL and right back to login page.
How can we reproduce the issue?
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
#from selenium.webdriver.edge.options import Options
import undetected_chromedriver as uc
from undetected_chromedriver import Chrome, ChromeOptions
from selenium.webdriver.support import expected_conditions as EC
import os
from dotenv import load_dotenv
import time
load_dotenv()
username = os.getenv('UNAME')
password = os.getenv('PASSWORD')
venue = "venue"
bookdate = '2024-09-12'
booktime = '2000'
sport = "basketball"
#print(username,password)
options = Options()
options.page_load_strategy = 'none'
options.add_argument('--disable-notifications')
options.add_argument('--incognito')
options.add_argument("--start-maximized")
options.add_experimental_option("detach", True)
driver = webdriver.Chrome(options=options)
def span_click(driver, xpath):
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, xpath))).click()
def span_keys(driver, xpath, value):
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, xpath))).send_keys(value)
driver.get("https://www.bookingsite.com")
#click login
span_click(driver,"//a[@class='btn btn--primary btn--grad btn--grad-org-outline']")
time.sleep(2)
#new tab after clicking login button
driver.switch_to.window(driver.window_handles[1])
#enter username, password and click login button
span_keys(driver,"//input[@name='pc-login-username']",username)
span_keys(driver,"//input[@name='pc-login-password']",password)
span_click(driver,"//div[@name='pc-login-btn']")
#time.sleep(1)
#try to wait for element appear after logged in
try:
WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.XPATH, "//ul[@class='el-menu-demo el-menu--horizontal el-menu']")))
except Exception as e:
print(f"An error occurred: {e}")
#get to the booking detail page
search_url = f"https://www.bookingsite.com/facilities/search-result?keywords={venue}&district=&startDate={bookdate}&typeCode=BASC&venueCode=291&sportCode=BAGM&typeName={sport}&frmFilterType=&venueSportCode=BAGM&isFree=false"
driver.get(search_url)
#When I add the below step, the browser cannot get to the booking detail page, but it can if i remove the belows
span_click(driver,"//div[@class='facility-search-box']//div[@class='text' and contains(span, 'search sport、venue')]")
span_keys(driver,"//div[@class='search-associate-input-box']//input",venue)Relevant log output
[29036:37044:0913/111029.233:ERROR:interface_endpoint_client.cc(722)] Message 2 rejected by interface blink.mojom.WidgetOperating System
Windows 10
Selenium version
4.24.0
What are the browser(s) and version(s) where you see this issue?
Chrome
What are the browser driver(s) and version(s) where you see this issue?
Chrome Driver 128.0.6613.120
Are you using Selenium Grid?
No response
Metadata
Metadata
Assignees
Labels
I-questionApplied to questions. Issues should be closed and send the user to community resources.Applied to questions. Issues should be closed and send the user to community resources.