def fillInputs(): switchFrame() getBrowser().find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/form/div/input[1]").send_keys("D") getBrowser().find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/form/div/input[4]").send_keys("D") getBrowser().find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/form/div/input[3]").send_keys("D") Select(getBrowser().find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/form/div/select[2]")).select_by_index(1) getBrowser().find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/form/div/div/div/input[1]").click() print("Arama başarılı.")
def addElements(): try: getBrowser().find_element_by_xpath("/html/body/div[3]/div[2]/form/div[1]/div/input[2]").click() print("Silme butonu çalışmıyor.") except: print("Silme butonu başarıyla çalışıyor.") getBrowser().find_element_by_xpath("/html/body/div[3]/div[2]/form/div[1]/div/input[1]").click() try: print("Ekleme fonksiyonu çalışmıyor") print("Hata :", getBrowser().find_element_by_xpath("/html/body/h2").text) except: print("Ekleme butonu başarılı.")
def Perfor(): getBrowser().find_element_by_xpath("/html/body/div[5]/ul/li[6]/a").click() switchFrame() getBrowser().find_element_by_id("txtPeriodFromDate").clear() getBrowser().find_element_by_id("txtPeriodFromDate").send_keys( "2019-01-02") getBrowser().find_element_by_id("txtPeriodToDate").clear() getBrowser().find_element_by_id("txtPeriodToDate").send_keys("2019-01-03") Select(getBrowser().find_element_by_xpath( "/html/body/div[1]/div[1]/div[2]/div[2]/div[2]/form/div[1]/select[1]") ).select_by_index(0) Select(getBrowser().find_element_by_xpath( "/html/body/div[1]/div[1]/div[2]/div[2]/div[2]/form/div[1]/select[2]") ).select_by_index(0) getBrowser().find_element_by_id("txtEmpName").clear() getBrowser().find_element_by_id("txtEmpName").send_keys("deneme") getBrowser().find_element_by_id("txtReviewerName").clear() getBrowser().find_element_by_id("txtReviewerName").send_keys("deneme") getBrowser().find_element_by_id("searchButton").click() try: print( "Sonuç:", getBrowser().find_element_by_xpath( "/html/body/div[1]/div[1]/div[1]").text) print("Arama başarılı.") except: print("Arama başarısız.") time.sleep(2) getBrowser().find_element_by_id("clearBtn").click() print("Temizleme başarılı.") print("Performans sayfası testi başarılı") time.sleep(1)
def kpilist(): getBrowser().switch_to_default_content() den = getBrowser().find_element_by_xpath( "/html/body/div[5]/ul/li[6]/ul/li[1]/a") time.sleep(2) getBrowser().execute_script("arguments[0].click();", den) switchFrame() getBrowser().find_element_by_xpath( "/html/body/div/div[3]/div/div[2]/div[2]/input").click() Select(getBrowser().find_element_by_id("txtJobTitle")).select_by_index(0) time.sleep(1) getBrowser().find_element_by_xpath( "/html/body/div/div/div[2]/div[2]/div[2]/form/div[1]/textarea" ).send_keys("deneme") getBrowser().find_element_by_xpath( "/html/body/div/div/div[2]/div[2]/div[2]/form/div[1]/input[1]" ).send_keys("1") getBrowser().find_element_by_xpath( "/html/body/div/div/div[2]/div[2]/div[2]/form/div[1]/input[2]" ).send_keys("10") getBrowser().find_element_by_xpath( "/html/body/div/div/div[2]/div[2]/div[2]/form/div[1]/input[3]").click( ) getBrowser().find_element_by_xpath( "/html/body/div/div/div[2]/div[2]/div[2]/form/div[2]/input[1]").click( ) try: print("Sonuç:", getBrowser().find_element_by_id("messageBalloon_success").text) print("İsteğe bağlı alanlar denetimi başarılı.") except: print("Alanlarını denetiminde hata oluştu.") time.sleep(2) getBrowser().find_element_by_xpath( "/html/body/div/div/div[2]/div[2]/div[2]/form/div[2]/input[2]").click( ) print("Temizleme başarılı.") print("Performans sayfası testi başarılı") time.sleep(1)
def login(username, password): getBrowser().maximize_window() getBrowser().get( "https://s2.demo.opensourcecms.com/orangehrm/symfony/web/index.php") getBrowser().find_element_by_css_selector( "input[name='txtUsername']").send_keys(username) getBrowser().find_element_by_css_selector( "input[name='txtPassword']").send_keys(password) getBrowser().find_element_by_id("btnLogin").click() try: getBrowser().find_element_by_id("spanMessage").is_displayed() print("Hatalı giriş") except: print("Giriş başarılı")
def logout(): getBrowser().find_element_by_link_text("Logout").click() print("Çıkış başarılı")
def optionalFrames(): den = getBrowser().find_element_by_xpath("/html/body/div[5]/ul/li[2]/ul/li[1]/ul/li[1]/a") time.sleep(2) getBrowser().execute_script("arguments[0].click();", den) switchFrame() getBrowser().find_element_by_id("btnSave").click() getBrowser().find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/form/input[1]") time.sleep(2) getBrowser().find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/form/input[2]").click() time.sleep(2) getBrowser().find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/form/input[3]").click() time.sleep(2) getBrowser().find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/form/input[4]").click() time.sleep(2) getBrowser().find_element_by_id("btnSave").click() try: getBrowser().find_element_by_xpath("/html/body/div[1]") print("İsteğe bağlı alanlar denetimi başarılı.") except: print("Alanlarını denetiminde hata oluştu.")
def customFields(): try: pim = getBrowser().find_element_by_xpath('//*[@id="pim"]/a') config = getBrowser().find_element_by_xpath('//*[@id="pim"]/ul/li[1]/a') custom = getBrowser().find_element_by_xpath('//*[@id="pim"]/ul/li[1]/ul/li[2]/a') action = ActionChains(getBrowser()) action.move_to_element(pim).move_to_element(config).move_to_element(custom).click().perform() time.sleep(3) switchFrame() getBrowser().find_element_by_id("customField_name").send_keys("DenemeAlanı") Select(getBrowser().find_element_by_id("customField_screen")).select_by_index(2) Select(getBrowser().find_element_by_id("customField_type")).select_by_index(1) getBrowser().find_element_by_id("btnSave").click() getBrowser().implicitly_wait(10) getBrowser().find_element_by_id("messageBalloon_success").text print("İsteğe bağlı alanlar denetimi başarılı.") except: print("Sayfa gösteriminde hata oluştu..")