from LaunchDriver import Browser from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions browser = Browser() browser.driver.find_element_by_id("").text # Locator of input box # use send_keys to send the values # clear is used to clear the present values #
from LaunchDriver import Browser from selenium.webdriver.common.by import By import time browser = Browser() browser.get_url() browser.driver.switch_to.frame("form1434677811") browser.driver.find_element_by_link_text("Software Testing Tutorials").click()
# How many links present # Capture all links # Click on the links from LaunchDriver import Browser from selenium.webdriver.common.by import By browser = Browser() browser.get_url("https://www.expedia.com/") browser.driver.implicitly_wait(10) links = browser.driver.find_element(By.TAG_NAME, "a") flight_sitemap = browser.driver.find_element(By.LINK_TEXT, "Flights Sitemap") print("Link is present", flight_sitemap.text) [print(link.text) for link in links] print("links present in a page", len(links)) browser.close_browser()
from LaunchDriver import Browser from selenium.webdriver.common.keys import Keys import time browser = Browser() browser.get_url() ele = browser.driver.find_element_by_name("q") print(ele.is_displayed()) print(ele.is_enabled()) ele.send_keys("Welcome") browser.driver.find_element_by_xpath( "//*[@id='tsf']/div[2]/div[1]/div[3]/center/input[1]").click() browser.close_browser() # ele.is_displayed() # To check the status if the element is displayed or not # ele.is_enabled() # To check the status if the element is enabled or not # ele.is_selected() # To check the status of the element if it is selected or not (Used at radio buttons)
from LaunchDriver import Browser import time def printTitle(): time.sleep(5) print(browser.driver.title) browser = Browser() browser.get_url() browser.get_url("https://www.facebook.com/") browser.driver.back() printTitle() browser.driver.forward() printTitle() browser.close_browser() # to go back - driver.back() # to go forward - driver.forward()