How to assign a specific string value in search box to get this hit entered blindly for creating a report using python and selenium?

被刻印的时光 ゝ 提交于 2020-07-16 06:18:31

问题


I am struggling with assigning a fix string value to be selected in a inspected search box using python but it's all in vein.

Please have a look in below image - here I want to choose the value automatically and get the create button clicked automatically:

from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium import webdriver
from selenium.webdriver.common.by import By

#All the inspected fields 
EMAILFIELD = (By.ID, "username")
PASSWORDFIELD = (By.ID, "password")
LOGINBUTTON = (By.ID, "Login")
CLICKBUTTON= (By.ID, "thePage:rtForm:createButton")
QUICKFINDSEARCH = (By.ID, "quickFindInput")

browser = webdriver.Chrome(
    executable_path=r"C:/Users/RYadav/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Python 3.8/chromedriver.exe")
browser.get('https://fleet.my.salesforce.com/')

# wait for email field and enter email
WebDriverWait(browser, 5).until(EC.element_to_be_clickable(EMAILFIELD)).send_keys("xyz@element.com")

# wait for password field and enter password
WebDriverWait(browser, 5).until(EC.element_to_be_clickable(PASSWORDFIELD)).send_keys("Happy@1234")

# Click Login - same id?
WebDriverWait(browser, 5).until(EC.element_to_be_clickable(LOGINBUTTON)).click()


#this is the code block I am directing to after hitting on the url shown in the image
browser.get('https://fleet.my.salesforce.com/reportbuilder/reportType.apexp')

for i in QUICKFINDSEARCH == ('users'):
#click on Create Button
    WebDriverWait(browser, 5).until(EC.element_to_be_clickable(CLICKBUTTON)).click()

来源:https://stackoverflow.com/questions/62212088/how-to-assign-a-specific-string-value-in-search-box-to-get-this-hit-entered-blin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!