forked from mohitpeshwani/Selenium_driver_with_python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasics_selenium3.py
More file actions
26 lines (19 loc) · 809 Bytes
/
basics_selenium3.py
File metadata and controls
26 lines (19 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'''
conditional commands are used to check wheater the fuction is working fine or not properly (Validation purpose)
(i) is_enable()
(ii) is_displayed()
(iii) is_selected()
prior this we need to select the selector to check for the element to use
using css selector and xpath selector
'''
from selenium import webdriver
from selenium.webdriver.common.by import By # need to use this selector
driver = webdriver.Chrome(executable_path="chromedriver.exe")
'''
Using the CSS_selector we are selecting input and checking wheather it's dispalyed properly or not
Executed : 1)is_displayed() 2)is_enabled()
'''
driver.get("https://www.google.com/")
element = driver.find_element(By.CSS_SELECTOR,"input[title='Search']")
print(element.is_displayed())
print(element.is_enabled())