i am trying to do a submit by using selenium but am unable to find the inputbox
this is my code
def check_water_bill(account_number):
driver = webdriver.Chrome(options=options) # Initialize the WebDriver
base_url = "https://waterauthority.com.fj/en/mybill//"
url = base_url
driver.get(url) # URL
wait = WebDriverWait(driver, 30)
try:
# Wait until the popup container is present
popup_container = wait.until(EC.presence_of_element_located( (By.XPATH, "//div[@class='popup-container']")))
popup_html = popup_container.get_attribute('innerHTML')
print(popup_html)
# Find and interact with the account number input field
account_number_input = wait.until(EC.visibility_of_element_located((By.XPATH, "//input[@name='account_number']")))
if account_number_input.is_displayed():
print("Yes")
else:
print("No")
except Exception as e:
print(f"Error: {e}")
finally:
driver.quit() # Always quit the WebDriver session at the end
my output so far is this:
<div id="water-bill-popup">
<span class="close-popup" id="close-popup">X</span> <!-- Close icon -->
<!-- Display the form at the top -->
<form id="water-bill-form" method="post">
<h3 class="form-heading">CHECK MY BILL</h3>
<label for="account_number">Account Number:</label>
<input type="text" name="account_number" id="account_number" required="">
<input class="submit center-button" type="submit" value="Check Water Bill">
</form>
</div>
Error: Message:
None
i dont get it if am able to find the popup container, why can i not find the input button
can i get some assistance please.
i tried locating by id and class but still had no luck
New contributor
helper tcell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.