如何使用Selenium自动化测试SAP CRM WebClient UI
发表于:2025-11-09 作者:千家信息网编辑
千家信息网最后更新 2025年11月09日,这篇文章主要介绍了如何使用Selenium自动化测试SAP CRM WebClient UI,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一
千家信息网最后更新 2025年11月09日如何使用Selenium自动化测试SAP CRM WebClient UI
这篇文章主要介绍了如何使用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 = "https://ldcijerry.corp:44354/sap/bc/bsp/sap/crm_ui_start/default.htm"; } @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("http://www.soso.com/"); // 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 ---"); }}感谢你能够认真阅读完这篇文章,希望小编分享的"如何使用Selenium自动化测试SAP CRM WebClient UI"这篇文章对大家有帮助,同时也希望大家多多支持,关注行业资讯频道,更多相关知识等着你来学习!
篇文章
测试
自动化
价值
兴趣
同时
更多
朋友
知识
编带
行业
资讯
资讯频道
频道
参考
学习
帮助
支持
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
数据库脱敏处理
安卓app软件开发代理
暴雪检索服务器
软件开发需要什么科目支持
wiley电子期刊数据库
档案管理软件网络版服务器
软件开发进度时间表
昆仑云服务器是什么
程序测试的数据库连接
推理服务器批发厂家
云南昆明比较快的dns服务器
中国外贸数据库有哪些
中煤能源集团网络安全项目
实验管理安排系统数据库数据图
视觉应用软件开发工程师
腾讯网络安全李怀刚
中仁软件开发有限公司
渭南新维度网络技术
内蒙古一对一网络技术服务哪家好
db2远程连接不显示数据库
服务器pcie插槽版本
数控设备软件开发专业
简单的软件开发合同模板
什么云服务器安全性好
为什么命令窗口打不开数据库
网络安全习题全解
软件开发计划所需工作描述
红包雨软件开发
成都系统软件开发服务费
软件开发可配置的流程