I was trying to automate the ticket creation automation for the verizon site https://myverizonenterprise.verizon.com/vec/public/quicktasks/repairs/index.html#/repairsqf/tickets/create
In this site I want to send the value to the dropdown box of state field. But, unfortunately no solution is working for me. I tried below code in python, but that didn't work.
state = driver.find_element_by_xpath("//*[@id='combobox-1062-trigger-picker']").click()
driver.find_element_by_xpath("//*[contains(text(), 'TX')]").click()
I have also tried following code.
state = driver.find_element_by_xpath("//*[@id='combobox-1062-trigger-picker']")
state.send_keys('TX')
Even this solution didn't work for me.
Can anybody provide me a working solution?
Thanks, Malleshappa Teli
Apply implicit wait or fluent wait in your code wherever it is required
Implicit wait
driver.implicitly_wait(15)
Explicit wait
WebDriverWait(driver, 3).until(EC.presence_of_element_located((By.XPATH, "//li[text()='TX']")))
Example code:
import time
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
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Chrome('/usr/local/bin/chromedriver') # Optional argument, if not specified will search path.
driver.implicitly_wait(15) # implicit wait
driver.get("https://myverizonenterprise.verizon.com/vec/public/quicktasks/repairs/index.html#/repairsqf/tickets/create");
driver.find_element_by_xpath("//input[@name='state']").click()
#WebDriverWait(driver, 3).until(EC.presence_of_element_located((By.XPATH, "//li[text()='TX']"))) #Wait for specific element
ActionChains(driver).move_to_element(driver.find_element_by_xpath("//li[text()='TX']")).perform()
driver.find_element_by_xpath("//li[text()='TX']").click()
driver.quit()