Tag: selenium

JUnit中的参数types不匹配

我对Selenium webdriver和Java相当陌生,以前我使用过Selenium IDE。 我试图从Excel工作表读取testing数据。 然后将其写入Eclipse控制台,该控制台可以正常工作,并且应该用于执行实际testing,但不起作用。 实际的testing不执行,因为我得到一个错误参数types不匹配。 代码如下所示: package Test_Excel; import java.io.FileInputStream; import java.io.IOException; import java.util.Arrays; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; @RunWith(Parameterized.class) public class TestWithExcelData { // Our two parameters private final int input; private final int resultExpected; // Constructor public TestWithExcelData(int input, int result) […]

我们不能使用Excel作为Selenium的对象存储库..?

我很好奇,知道在使用selenium webdriver实现自动化框架时,为什么我们不能使用excel作为对象库,为什么每个人都使用PageObject或属性文件来存储所有的定位器。 我在想,如果我们使用excel来保存所有元素定位器,那么很容易将所有定位器保存在一个地方/一个excel中,如果需要,我们也可以轻松地更改定位器path。 虽然我正在寻求build议,然后再实施,如果使用excel有什么不利之处。

如何使selenium等待页面完全加载到Excel VBA的包装?

Selenium的什么代码或函数 – 用于Excel VBA的包装器,以便程序等待页面完全加载然后执行其他命令?

自动设置WebDriver的configuration文件来打开Excel文件

我find了解决scheme来悄悄下载文件(没有打开/保存对话框),但找不到任何设置WebDriverconfiguration文件自动打开一个文件而不保存。 使用selenium和C#。 该文件是一个.csv,这里是我的代码: FirefoxProfile profile = new FirefoxProfile(); //set to automatically open file profile.SetPreference("browser.helperApps.alwaysAsk.force", false); profile.SetPreference("browser.helperApps.neverAsk.openFile","text/csv,application/vnd.ms-excel,application/excel"); profile.SetPreference("browser.download.manager.showWhenStarting", false); Instance = new FirefoxDriver(profile); 我是否缺less插件?

Apache POI破坏文件

我正在尝试使用Java中的Apache POI更新Selenium中的Excel文件。 但是,当我打开Excel文件,它显示损坏。 以下是我的Java代码。 import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.ArrayList; import java.util.List; import javax.print.attribute.standard.JobHoldUntil; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.util.CellReference; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.jboss.netty.util.internal.SystemPropertyUtil; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class Test_Copy_Write1 { public static void main(String[] args) throws Exception { // get Pace […]

seleniumWebdriver:date字段正在填充string发送,但稍后更改为其他date一旦焦点改变

我需要在我的应用程序的date字段中inputdate。 我已经做了一个Java代码,每天都这样做。 所以我只是在电子表格列中inputdate和数据。 使用apache poi和selenium webdriver,我将获取它并在应用程序的date字段中input。 date字段有一个日历popup时,有一个焦点设置在那里。 我简单地绕过它,通过清除字段中的默认date,并从Excel表格中inputdate作为string。 上面的逻辑工作正常。 但现在我input的date是2015年6月12日(美国时区),inputdate也是一样的。 但是当焦点设置到下一个字段时,date变为2015年12月16日。 我不明白为什么会发生这种情况,当然,怎么可能避免呢? private static void setBloodGlucose(String vitalname, String date, String time, String vitaldata) throws Exception { Log.info("Entering vital data: " + vitalname); KeyActions.click(OR, "btnGearBloodGlucose"); KeyActions.clickById(OR, "btnBloodGlucose"); KeyActions.waitFor("4"); KeyActions.input(OR, "txtBloodGlucoseDate", date); KeyActions.input(OR, "txtBloodGlucoseTime", time); KeyActions.input(OR, "txtBloodGlucose", vitaldata); KeyActions.clickById(OR, "btnBloodGlucoseSave"); } public static void waitFor(String data) throws […]

Excel VBA Selenium打开本地网页运行时错误以及内存不足错误

我有一个本地.HTM文件的列表,我想用VBA (Excel 2013)中的Selenium进行parsing。 我遇到两个问题,但首先一些示例代码: Sub openSelenium() Dim html As HTMLDocument Dim selenium As SeleniumWrapper.WebDriver Set selenium = New SeleniumWrapper.WebDriver selenium.Start "firefox", "about:blank" selenium.Open "file:///D:/webpages/LE_1001.htm" Set html = selenium.getHtmlSource End Sub 基本上我想要的是将每个本地网站的HTML Source Code存储在一个HTMLDocument元素中,这样我就可以使用HTMLDocument因为我熟悉它。 我在Windows 7 Pro SP1上使用FireFox v43.0.2和Excel 2013。 问题:上面的代码打开了FireFox,但是转到这个网页:“ https://www.mozilla.org/de/firefox/43.0.2/firstrun/learnmore/ ”并停在这里。 VBA很快就会冻结,并收到以下消息: 我收到Excel Out of memory消息。 有时甚至在重新启动计算机之后仍收到此消息。 但这并不经常发生。 第一点更是一个问题。 任何帮助深表感谢。

在java中调用方法(包括Selenium / Apache-POI)

我创build了一个类'ReadURL',它提取了一个excel中存在的URL。 public class ReadURL { static String val; public String readExcel(String path,String tab,int rowNum,int cellNum) throws Exception { FileInputStream fis = new FileInputStream(path); Workbook wb = WorkbookFactory.create(fis); Sheet sh = wb.getSheet(tab); Row row = sh.getRow(rowNum); String val = row.getCell(cellNum).getStringCellValue(); return val; } } 我从另一个具有主要方法的类“DeadLinks”通过声明值调用上述方法。 public class DeadLinks { public static void main(String[] args) throws Exception […]

如何等待testing执行完成在Selenium Webdriver?

我在Selenium Java中有一个testing框架,我将Test作为TestNG项目运行。 现在,我把excel表中的标志设置为Y或者N,每Y行读取对应的数据,然后用这些数据login并打开一个.exe文件。 我遇到的问题是一旦.exe打开,代码读取下一个Y标志并读取数据。 我想要的是从excel中读取第一个Y,执行testing用例,然后读取下一个Y标志,依此类推。 任何build议将有很大的帮助。 谢谢!!

提取的数据不存储在scrapy项目中

我正在使用scrapy和selen在python中构build一个屏幕刮板的项目,然后使用xlsxwriter将其输出到一个excel文件中。 但是,似乎我的scrapy项目总是空着。 我不确定在这一点发生了什么,所以任何帮助表示赞赏。 只是要注意,在这里张贴之前,有几个url,目录和其他一些敏感信息。 所以一些链接和目录可能看起来很奇怪。 excel输出的屏幕截图: 屏幕刮板文件输出 蜘蛛: import os import time from datetime import date from ScreenScraper.items import * from scrapy import * from scrapy.http import FormRequest from scrapy.loader import ItemLoader from scrapy.selector import Selector from selenium import webdriver from selenium.webdriver.common.keys import Keys from xlsxwriter import * class CquentiaSpider(Spider): name = 'cquentia' allowed_domains = […]