Пример #1
0
 def openBrowser(self):
     driver.get(url)
     driver.maximize_window()
     time.sleep(1)
     driver.implicitly_wait(10)
     driver.delete_all_cookies()
     time.sleep(1)
Пример #2
0
def test_login():
    driver.get(url1)
    driver.implicitly_wait(6)
    driver.maximize_window()

    pop_up = driver.find_element_by_xpath(
        '//div[@class="Og_iib col col-2-5 _3SWFXF"]').is_displayed()
    if pop_up == True:
        driver.find_element_by_xpath(
            '//input[@class="_2zrpKA _1dBPDZ"]').send_keys(9591593927)
        driver.find_element_by_xpath('//input[@type="password"]').send_keys(
            9880424831)
        driver.find_element_by_xpath(
            '//button[@class="_2AkmmA _1LctnI _7UHT_c"]').click()

    else:
        driver.find_element_by_xpath('//div[@class="_2aUbKa"]').click()
 def get_url(self):
     print("in url")
     driver.get(url[0])
     driver.maximize_window()
Пример #4
0
from selenium.webdriver.support.select import Select
from settings import driver

filepath = r'C:\Users\vidya gowda\PycharmProjects\Selenium_DemoProject\html_files\Select_dropdown.html'
import time

driver.get(filepath)
driver.maximize_window()
element = driver.find_element_by_id("cars")
s = Select(element)
s.select_by_value("sub1")
time.sleep(2)
s.select_by_index(3)
time.sleep(2)
s.select_by_visible_text("Mysore")
time.sleep(2)

options = s.options
print(options)
print("all_options are")
for i in options:
    print(i.text)
print()
selected_options = s.all_selected_options
print(selected_options)
print("all_selected_options are")
for i in selected_options:
    print(i.text)
print()
first_selected = s.first_selected_option
print("first_selected_option : ", first_selected.text)
from settings import driver, url

driver.get(url[0])
driver.maximize_window()
#driver.find_element_by_css_selector('input[id="username"]').send_keys("admin")
driver.find_element_by_css_selector("input#username").send_keys("admin")
driver.find_element_by_css_selector("input.textField.pwdfield").send_keys(
    "manager")
bool_value = driver.find_element_by_css_selector(
    "input#keepLoggedInCheckBox").is_selected()
print("is selected o/p :", bool_value)
print(driver.find_element_by_css_selector("input#username").is_enabled())
print(driver.find_element_by_partial_link_text("Forgot").is_displayed())
print(driver.find_element_by_partial_link_text("Forgot").tag_name)
print(driver.find_element_by_id("loginButton").text)
print(driver.find_element_by_id("loginButton").get_attribute("href"))
print(driver.find_element_by_id("loginButton").location)
print(driver.find_element_by_id("loginButton").size)
print(driver.find_element_by_id("loginButton").rect)
print(driver.find_element_by_id("loginButton").value_of_css_property("Font"))
 def get_url(self):
     # driver.get(c_path)
     # driver.get(s_path)
     driver.get(p_path)
     driver.maximize_window()
Пример #7
0
from settings import driver,url

driver.get(url[2])
driver.maximize_window()
cookies = driver.get_cookies()
print("all cookies are \n",cookies)
driver.add_cookie({"name":"xyz","value":"python"})
cookies = driver.get_cookies()
print("all cookies are \n",cookies)
print(driver.get_cookie('name'))
driver.delete_cookie("xyz")
cookies = driver.get_cookies()
print("all cookies are \n",cookies)
driver.delete_all_cookies()
driver.close()
from settings import driver,url
import time
driver.get("https://demo.actitime.com/login.do")
driver.maximize_window()
driver.minimize_window()
driver.fullscreen_window()
driver.back()
driver.forward()
driver.refresh()
print(driver.title)
print(driver.current_url)
print(driver.name)
pos = driver.get_window_position()
print("position is : ",pos)
size = driver.get_window_size()
print("size is : ",size)
rect = driver.get_window_rect()
print("rect is : ",rect)
driver.set_window_position(30,40)
time.sleep(2)
driver.set_window_size(1000,500)
time.sleep(2)
driver.set_window_rect(50,50,800,300)
time.sleep(2)
print(driver.page_source)
driver.set_page_load_timeout(10)
driver.close()
driver.quit()

Пример #9
0
 def get_url(self):
     driver.get(url[1])
     driver.maximize_window()