Movatterモバイル変換


[0]ホーム

URL:



Code forAutomated Browser Testing with Edge and Selenium in Python Tutorial


View on Github

main1.py

# importing required package of webdriverfrom selenium import webdriver# Just Run this to execute the below scriptif __name__ == '__main__':   # Instantiate the webdriver with the executable location of MS Edge web driver   browser = webdriver.Edge(r"C:\Users\LenovoE14\Downloads\edgedriver\msedgedriver.exe")   # Simply just open a new Edge browser and go to lambdatest.com   browser.get('https://www.lambdatest.com')

main2.py

# importing required package of webdriverfrom selenium import webdriverfrom selenium.webdriver.chrome.options import Optionsfrom time import sleepfrom selenium.webdriver.support import expected_conditions as ECfrom selenium.webdriver.common.by import Byfrom selenium.common.exceptions import TimeoutExceptionfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.opera.options import Options# Just Run this main.py to execute the below scriptfrom selenium.webdriver.support.wait import WebDriverWaitif __name__ == '__main__':    # Instantiate the webdriver with the executable location of MS Edge    browser = webdriver.Edge(r"C:\Users\LenovoE14\Downloads\edgedriver\msedgedriver.exe")    # Simply just open a new Edge browser and go to lambdatest.com    browser.maximize_window()    browser.get('https://www.lambdatest.com')    try:        # Get the text box to insert Email using selector ID        myElem_1 = WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.ID, 'useremail')))        # Entering the email address        myElem_1.send_keys("rishabhps@lambdatest.com")        myElem_1.click()        # Get the Submit button to click and start free testing using selector CSS_SELECTOR        myElem_2 = WebDriverWait(browser, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "#testing_form > div")))        # Starting free testing on LambdaTest        myElem_2.click()        sleep(10)    except TimeoutException:        print("No element found")    sleep(10)    browser.close()

Ethical Hacking with Python EBook - Resources - Top


Join 50,000+ Python Programmers & Enthusiasts like you!



Tags

Ethical Hacking with Python EBook - Home - Middle


New Tutorials

Popular Tutorials


Ethical Hacking with Python EBook - Topic - Bottom







[8]ページ先頭

©2009-2025 Movatter.jp