Tag: selenium

将testing时间追加到最终用户友好的.xls / .csv文件中

现在,我们成功/准确地报告testingID,说明,预期结果和通过/失败值。 我想添加运行testng.xml(执行和完成testing所需的时间)结束时可以看到的值,并将其附加到我的文件中。 有没有办法loggingTestNGtesting所花费的时间并将其输出到Excel / CSV中?

Selenium + VBA控制Chrome

我用selenium + vba启动chrome打开10个单元格区域(“A1:A10”)列出的URL。 我不熟悉selenium,经过很多次我终于出来下面笨重的代码。 Private selenium As New ChromeDriver Sub test() Dim cell As Range Dim keys As New selenium.keys Dim pageNo As Integer pageNo = 0 selenium.Start "chrome", "http://www.google.com/" For Each cell In Range("A1:A10") If pageNo >= 1 Then selenium.SendKeys keys.Control & "t" + keys.Control & "t" selenium.SwitchToNextWindow End If selenium.Get cell.Value pageNo = […]

如何将variables设置为ApachePOI迭代的数据值

我有两个脚本; 一个用Apache POI从Excel工作表中读取数据,另一个用于从Apache脚本中获取接收到的数据,并将这些数据用于input字段。 这里是我的apache excel读写器脚本: public class readExcelFinal{ static ArrayList<Double> priceList; static ArrayList<String> titleList; static ArrayList<String> descriptionList; static ArrayList<String> imageLocationList; public static void processExcelFile(String fileName) throws IOException{ priceList = new ArrayList<Double>(); titleList = new ArrayList<String>(); descriptionList = new ArrayList<String>(); imageLocationList = new ArrayList<String>(); try{ FileInputStream myInput = new FileInputStream(fileName); POIFSFileSystem myFileSystem = new POIFSFileSystem(myInput); HSSFWorkbook […]

根据电子表格select页面上的值 – Java – Selenium Webdriver

我需要阅读电子表格的值,并在页面上select相同的值。 使用下面的代码,我可以读取电子表格的第一列和第二列,并填写页面上的字段,但是我无法读取第三列并selectSelect页面的值。 如何使用Java和Selenium? package testeplanilha; import java.io.File; import java.io.IOException; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; import org.openqa.selenium.By; 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.Select; public class testePlanilha { public static void main(String[] args) throws BiffException, IOException { String nome = ""; String sobrenome= ""; String tipo = ""; WebDriver driver […]

按照单张页面单击一个单选button的值 – Java – Selenium Webdriver

如何在工作表上读取一个值,并使用java和Selenium Webdriver在页面上的单选button中select相同的值? Workbook workbook = Workbook.getWorkbook(new File("C:/plan.xls")); Sheet sheet = workbook.getSheet(0); int rowCount = sheet.getRows(); for(int i = 0; i < rowCount; i++){ String nome2 = sheet.getCell(0, i).getContents(); String Sobrenome2 = sheet.getCell(1, i).getContents(); String tipo2 = sheet.getCell(2, i).getContents(); String aparelho = sheet.getCell(3, i).getContents(); driver.findElement(By.id("nome")).sendKeys(nome2); driver.findElement(By.id("sobrenome")).sendKeys(Sobrenome2); Select verificaOpt = new Select(driver.findElement(By.id("select"))); // as before String titleCaseType […]

我们可以使用java更新密码保护excel表的行和列吗?

NPOIFSFileSystem fs = new NPOIFSFileSystem(new File("C://Users//RK5026051//Downloads//500_Lanes.xls")); EncryptionInfo info = new EncryptionInfo(fs); Decryptor d = Decryptor.getInstance(info); if (d.verifyPassword("manh.com")) { HSSFWorkbook wb = new HSSFWorkbook(d.getDataStream(fs)); } else { System.out.println("wrong password"); } // TODO Auto-generated method stub } 错误 – Exception in thread "main" java.io.FileNotFoundException: no such entry: "EncryptionInfo", had: [_VBA_PROJECT_CUR, SummaryInformation, DocumentSummaryInformation, Workbook] at org.apache.poi.poifs.filesystem.DirectoryNode.getEntry(DirectoryNode.java:370) at org.apache.poi.poifs.filesystem.DirectoryNode.createDocumentInputStream(DirectoryNode.java:177) […]

不能从Excel单元格获取数值

public Object[][] dataProviderMethod() throws IOException { try { file = new FileInputStream(new File("/Users/nanthakumar/Documents/workspace/Myna_Admin/src/com/myna/testdata/login.xls")); workbook = new HSSFWorkbook(file); sheet = workbook.getSheetAt(0); row = sheet.getLastRowNum() + 1; col = sheet.getRow(0).getLastCellNum(); data = new String[row][col]; for (i = 0; i < row; i++) { rowvalue = sheet.getRow(i); for (j = 0; j < col; j++) { cellValue = […]

Linux文件访问通过jenkins权限被拒绝

我正在通过jenkins运行seleniumtesting。 所有的软件包都上传到linux服务器。 在我的testing中,需要读写excel。 每当我上传新的xls文件,我必须运行以下命令: chmod 777 path / test.xls 如果我在Linux上更换新的excel并通过jenkins运行build而不运行上面的命令,Jenkins说权限被拒绝。 有什么命令设置永久权限从Linux访问文件?

Robot Framework和Selenium调用java方法

我devise了一个机器人脚本来testingSelenium的网页。 执行脚本后,Selenium将生成log.html和report.html,它提供了一些关于testing的反馈。 不过,我想输出像Excel格式。 我使用Java从apachefind了EXCEL库。 我如何收集信息并致电图书馆输出excel?

无法使用Apache POI ss用户模型添加工作表

我试图添加表与Apache POI,但是我得到空指针exception,当我试图保存excel。不知道为什么发生这种情况,但数据更新到Excel发生完美。 发生exception:org.apache.poi.POIXMLException:java.lang.NullPointerException public XL_ReadWrite(String path) throws Exception{ this.path = path; try{ fin = new FileInputStream(path); workbook = WorkbookFactory.create(fin); sheet = workbook.getSheetAt(0); fin.close(); } catch(FileNotFoundException e){ throw new Exception("Exception occurred while finding the file : " + path + " while XLS initialize .Exception details : "+e.getMessage()); } catch(IOException e){ throw new Exception("I/O interrupted exception […]