使用Selenium自動化測試SAP CRM WebClient UI
package com.xc.crm.test; import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.WebDriverWait; public class CRMTest { private WebDriver myDriver; private String crmURL; private String mainWindowHandle; private String popupWindowHandle; @Before public void setUp() throws Exception { // System.setProperty("webdriver.ie.driver","C:\\xiechuan\\30_Software\\02_Selenium\\IEDriverServer_x64_2.26.2\\IEDriverServer.exe"); // DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer(); // ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true); // myDriver = new InternetExplorerDriver(ieCapabilities); myDriver = new FirefoxDriver(); crmURL = " } @After public void tearDown() throws Exception { } @Test public void test() throws InterruptedException { System.out.println("--- Test Start ---"); // This is for initial the tab in browser // myDriver.navigate().to("); // Thread.sleep(5000); myDriver.navigate().to(crmURL); System.out.println("In Testing: Open CRM Logon page"); Thread.sleep(15000); myDriver.findElement(By.id("sap-user")).clear(); myDriver.findElement(By.id("sap-password")).clear(); myDriver.findElement(By.id("sap-user")).sendKeys("XIE"); myDriver.findElement(By.id("sap-password")).sendKeys("Xc12"); myDriver.findElement(By.cssSelector("span.urBtnCntTxt")).click(); System.out.println("In Testing: Logon on CRM"); Thread.sleep(15000); myDriver.findElement(By.id("SERVICEPRO")).click(); System.out.println("In Testing: Click Service Professional"); Thread.sleep(30000); myDriver.switchTo().frame("CRMApplicationFrame"); Thread.sleep(10000); myDriver.switchTo().frame("WorkAreaFrame1"); Thread.sleep(10000); System.out.println("In Testing: Switched to CRMApplicationFrame-WorkAreaFrame1"); // Create service order // AG3 // myDriver.findElement(By.id("C5_W18_V19_SRV-ORD-DC")).click(); // QD3 myDriver.findElement(By.id("C5_W19_V20_SRV-ORD-DC")).click(); System.out.println("In Testing: Click to create Service Order"); Thread.sleep(20000); // AG3 // myDriver.findElement(By.id("C31_W109_V112_V113_btrefobjmain_struct.ib_ibase-btn")).click(); // QD3 myDriver.findElement(By.id("C32_W114_V117_V118_btrefobjmain_struct.ib_ibase-btn")).click(); System.out.println("In Testing: Click value help to search IBase"); mainWindowHandle = myDriver.getWindowHandle(); System.out.println("In Testing: " + "Main Window: " + mainWindowHandle + " / " + myDriver.getTitle()); Thread.sleep(10000); for (String myHandle : myDriver.getWindowHandles()) { System.out.println("In Testing: " + "Current Handle: " + myHandle); if(!myHandle.equals(mainWindowHandle)) { popupWindowHandle = myHandle; myDriver.switchTo().window(popupWindowHandle); System.out.println("In Testing: " + "Popup Window: " + myDriver.getWindowHandle() + " / " + myDriver.getTitle()); break; } } myDriver.switchTo().frame("WorkAreaFrame1"); System.out.println("In Testing: Switched to pop-up WorkAreaFrame1"); Thread.sleep(20000); // Enter IBase ID // AG3 // myDriver.findElement(By.id("C36_W133_V135_V136_V141_search_parameters[1].VALUE1")).clear(); // myDriver.findElement(By.id("C36_W133_V135_V136_V141_search_parameters[1].VALUE1")).sendKeys("4448"); // QD3 myDriver.findElement(By.id("C37_W137_V139_V140_V145_search_parameters[1].VALUE1")).clear(); myDriver.findElement(By.id("C37_W137_V139_V140_V145_search_parameters[1].VALUE1")).sendKeys("12"); System.out.println("In Testing: Pop-up search parameter entered"); // Click search button // AG3 // myDriver.findElement(By.id("C36_W133_V135_Searchbtn")).click(); // QD3 myDriver.findElement(By.id("C37_W137_V139_Searchbtn")).click(); System.out.println("In Testing: Click search button in Pop-up window"); Thread.sleep(10000); // Select the row in search result // AG3 // myDriver.findElement(By.id("C36_W133_V135_V137_Table_sel_1-rowsel")).click(); // QD3 myDriver.findElement(By.id("C37_W137_V139_V141_Table_sel_1-rowsel")).click(); System.out.println("In Testing: Select search result in Pop-up window"); Thread.sleep(10000); System.out.println("--- Test End ---"); } }
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2677214/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- python+selenium UI自動化測試環境搭建及使用PythonUI
- SAP CRM WebClient UI異常的持久化機制WebclientUI持久化
- selenium自動化測試
- UI自動化測試之selenium超神之路(1)UI
- 自動化測試框架Selenium的使用——安裝Selenium框架
- 自動化測試系列 —— UI自動化測試UI
- Selenium自動化測試(3)
- SAP CRM WebClient UI和Fiori UI混搭並存WebclientUI
- 使用 Python 和 Selenium 自動化網頁測試Python網頁
- python自動化測試工具selenium使用指南Python
- Selenium自動化測試網頁網頁
- selenium+python自動化測試Python
- java+selenium 自動化測試Java
- Selenium用法詳解 - - selenium自動化測試概要
- SAP CRM WebClient UI和Hybris backoffice UI開發的相同點WebclientUI
- 自動化測試系列(三)|UI測試UI
- SAP WebClient UI component context node class單元測試方法WebclientUIContext
- Selenium用法 - - 自動化測試介紹
- 自動化測試 selenium 環境搭建
- 在SAP CRM WebClient UI中用javascript觸發ABAP eventWebclientUIJavaScript
- 將SAP CRM WebClient UI的表格匯出成PDFWebclientUI
- ui自動化測試,頁面方法的使用UI
- Web自動化-Selenium自動化測試-4-編寫測試用例Web
- UI 自動化測試平臺UI
- UI自動化測試之AirtestUIAI
- UI自動化測試實戰UI
- 用python實現selenium 自動化測試Python
- 使用note++開發SAP WebClient UIWebclientUI
- 如何在SAP WebClient UI裡使用jChartFXWebclientUI
- SAP CRM WebClient UI的Delta處理機制介紹WebclientUI
- 在SAP CRM WebClient UI裡開啟ABAP Webdynpro頁面WebclientUI
- SAP CRM WebClient UI和ABAP Webdynpro頁面的互相跳轉WebclientUI
- SAP CRM WebClient UI html 格式的 Text 顯示邏輯WebclientUIHTML
- SAP CRM WebClient UI 支援的一些 url 引數WebclientUI
- SAP UI5 自動化測試工具的 qunit-redirect.jsUIJS
- 關於 SAP UI5 應用的自動化測試方法UI
- 自動化測試進階課程——Selenium自動化測試通關實戰班
- 自動化運維:使用Maven與Docker執行Selenium測試運維MavenDocker