修改URL查询参数后页面无变化?Sixt预订页技术求助
Hey there! Let's break down why your Sixt booking page approach isn't working and get you fixed up step by step.
First off, the core issue is about how web forms send data:
- When you use
driver.get(url + "?" + form_data), you're sending a GET request—but that Sixt booking form almost certainly uses a POST request to submit information. - GET requests stick all form data in the URL, while POST requests send data in the "body" of the request (not visible in the address bar). Most booking platforms use POST for this kind of data to keep things secure and handle more complex inputs. That's why appending your
form_datato the URL does nothing—the server isn't looking for those parameters there!
As for why manually changing uda/rda in your form_data string didn't help: you only modified a local string, never actually sent that updated data to the server in a valid request.
Since you're new to this, I'll start with the easiest, most reliable method (simulating real user actions) and cover an advanced option if you're curious.
Option 1: Simulate User Actions with Selenium (Best for Beginners)
This approach mimics how a human would fill out the form—Selenium handles all the behind-the-scenes HTTP stuff automatically, so you don't have to worry about GET vs POST.
Here's a working code example:
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 # Initialize your browser driver (Chrome here—adjust for Firefox/Edge if needed) driver = webdriver.Chrome() # Open the Sixt booking page driver.get("https://www.sixt.ie/php/reservation/offerselect") # Wait for the page to load (WebDriverWait is more reliable than time.sleep) wait = WebDriverWait(driver, 10) # Update pickup date pickup_date = wait.until(EC.visibility_of_element_located((By.NAME, "uda"))) pickup_date.clear() pickup_date.send_keys("25.05.2018") # Update pickup time pickup_time = wait.until(EC.visibility_of_element_located((By.NAME, "uti"))) pickup_time.clear() pickup_time.send_keys("10:00") # Update return date return_date = wait.until(EC.visibility_of_element_located((By.NAME, "rda"))) return_date.clear() return_date.send_keys("26.05.2018") # Update return time return_time = wait.until(EC.visibility_of_element_located((By.NAME, "rti"))) return_time.clear() return_time.send_keys("09:30") # Submit the form (adjust the selector if the button changes) submit_button = wait.until(EC.element_to_be_clickable((By.XPATH, "//button[@type='submit']"))) submit_button.click() # Wait for results to load before proceeding wait.until(EC.title_contains("Offers"))
Option 2: Send a Direct POST Request (Advanced)
If you want to skip manual form filling, you can send a POST request directly using the requests library, then load the response in Selenium if needed. This is trickier because you might need to match the site's cookies or headers to avoid being blocked.
Here's a quick example:
import requests from selenium import webdriver url = "https://www.sixt.ie/php/reservation/offerselect" # Convert your form data string to a dictionary for easy editing form_data = { "tab_identifier": "1526583730", "uci": "1385", "rci": "1385", "uli": "IE", "rli": "IE", "layout": "list", "posl": "IE", "is_corpcust": "", "has_social_login": "", "pu_eq_ret": "1", "uda": "25.05.2018", "uti": "10:00", "geo_del_name": "", "geo_del_street": "", "geo_del_postcode": "", "geo_del_town": "", "geo_del_country": "AT", "del_note": "", "rda": "26.05.2018", "rti": "09:30", "geo_col_name": "", "geo_col_street": "", "geo_col_postcode": "", "geo_col_town": "", "geo_col_country": "AT", "col_note": "" } # Send the POST request response = requests.post(url, data=form_data) # Load the response in Selenium if needed driver = webdriver.Chrome() driver.get("data:text/html;charset=utf-8," + response.text)
Pro tip for beginners:
Stick with Option 1 first—it's far more resilient to changes on Sixt's site, whereas direct POST requests can break if the site updates its security rules.
内容的提问来源于stack exchange,提问作者Bhaskar Sri Lalith Kuchimanchi

