0% found this document useful (0 votes)
7 views1 page

7 Webelement Actions

Uploaded by

swati patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

7 Webelement Actions

Uploaded by

swati patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

import time

from selenium import webdriver

opts = webdriver.ChromeOptions()
opts.add_experimental_option("detach", True)
driver = webdriver.Chrome(options=opts)

path = r"C:\Users\Vidyashree M C\selenium_class_projects\demo_apps\locators\basic_locators.html"


driver.get(path)

# locate username text field


username = driver.find_element("id", "username")
# print(username)
time.sleep(2)

# interacting with username webelement

# clicks on the element


username.click() # buttons, links, checkboxes

# write the given value into the textfield


username.send_keys("John")
username.send_keys(10)

# checks if the element is enabled


print(username.is_enabled())

# checks if the element is not hidden/ visible in the webpage


print(username.is_displayed())

driver.close()

You might also like