Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
1.4 kB
1
Indexable
// Step 1: Select the desired date from the dropdown
var dateDropdown = document.getElementById('reservation_date');
if (dateDropdown) {
    dateDropdown.value = "2024-08-17"; // Set your desired date in YYYY-MM-DD format
    var event = new Event('change', { bubbles: true });
    dateDropdown.dispatchEvent(event);
    console.log("Date set to 2024-08-17.");
}

// Step 2: Select the desired time slot (e.g., 1:00pm)
var timeSlotContainer = document.querySelector('div.slot_container[data-time=" 1:00pm"]');
if (timeSlotContainer) {
    var timeSlot = timeSlotContainer.querySelector('.slot');
    if (timeSlot) {
        timeSlot.click(); // Simulate the click on the time slot
        console.log("Time slot 1:00pm clicked.");

        // Step 3: Confirm the reservation if necessary
        var confirmButton = timeSlotContainer.querySelector('.confirm');
        if (confirmButton && confirmButton.textContent.includes("Click again to reserve")) {
            confirmButton.click(); // Simulate the confirmation click
            console.log("Confirmation clicked.");
        }
    }
}

// Step 4: Click the "Reserve" button to submit the form
var reserveButton = document.querySelector('input[type="submit"][value="Reserve"]');
if (reserveButton) {
    reserveButton.style.display = 'block'; // Make sure the button is visible
    reserveButton.click(); // Trigger the reserve button
    console.log("Reserve button clicked.");
}
Leave a Comment