我正在尝试在Maven项目中使用Selenium的最新版本3.4.0。我使用以下依赖项导入了所有Selenium的jar:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
问题是我无法在Eclipse中的主要方法中的以下代码中解决我项目中的任何依赖项:-
public class FirefoxTest {
public static void main(String[] args) {
FirefoxOptions options = new FirefoxOptions();
options.setBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); //This is the location where you have installed Firefox on your machine
FirefoxDriver driver = new FirefoxDriver(options);
driver.get("http://www.google.com");
}
}
Run Code Online (Sandbox Code Playgroud)
我想念什么?Eclipse无法将FirefoxDriver类型解析为任何依赖项。请帮忙。
我在 Java 中使用 selenium 使用以下代码。我添加了 4 秒的 pageLoadTimeout,但是,驱动程序继续等待,直到加载完整页面。有什么帮助吗?
System.setProperty("webdriver.gecko.driver", System.getProperty("user.home") + "\\Desktop\\geckodriver.exe");
FirefoxBinary b = new FirefoxBinary(new File(System.getProperty("user.home") + "\\desktop\\Mozilla Firefox\\firefox.exe"));
FirefoxOptions options = new FirefoxOptions().setBinary(b);
driver = new FirefoxDriver(options);
//driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(4, TimeUnit.SECONDS);
driver.get("https://www.booking.com/hotel/in/the-taj-mahal-palace-tower.html?label=gen173nr-1FCAEoggJCAlhYSDNiBW5vcmVmaGyIAQGYATG4AQbIAQzYAQHoAQH4AQKSAgF5qAID;sid=338ad58d8e83c71e6aa78c67a2996616;dest_id=-2092174;dest_type=city;dist=0;group_adults=2;hip_dst=1;hpos=1;room1=A%2CA;sb_price_type=total;srfid=ccd41231d2f37b82d695970f081412152a59586aX1;srpvid=c71751e539ea01ce;type=total;ucfs=1&#hotelTmpl");
List<WebElement> facilitySectionList = driver.findElements(By.className("facilitiesChecklistSection"));
Run Code Online (Sandbox Code Playgroud) 我对 JTable 有一个非常奇怪的问题。
我将数据从 DB 放入 JTable 中。当用户双击任何单元格时,它会复制用户双击所在行的第一列的单元格内容。到目前为止,它运行完美。
当用户通过单击标题对 JTable 进行排序时,就会出现问题。当表格已排序并且现在当用户双击任何行时,它不会当前存储在该行的第一列上。当 JTable 未排序时,它复制最初存储在该行第一列的内容。
有任何想法吗?
我可以使用 REST 客户端 (Insomnia) 发布此请求。但是,当我无法编写正确的代码在 Java 中执行相同操作时。下面是我的失眠请求的样子。
下面是客户端生成的代码的样子。
HttpResponse<String> response = Unirest.post("http://172.16.6.15:5053/image-service/services/image-panel-service/panel/images?=")
.header("com.yatra.tenant.header.tenantid", "1051")
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageFile\"\r\n\r\n")
.asString();
Run Code Online (Sandbox Code Playgroud)
下面是我用 Java 编写的代码,但它不起作用。
try {
HttpResponse<String> response = Unirest.post("http://172.16.6.15:5053/image-service/services/image-panel-service/panel/images")
.header("com.yatra.tenant.header.tenantid", "1051")
.header("content-type", "multipart/form-data")
.field("imageFile", new File("Desert.jpg"))
.field("imageData", new File("ImageUploadRequest.json")).asString();
System.out.println(response.getBody());
} catch (UnirestException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud) 我正在使用POI API for Java自动化excel报告.我将处理的报告很少,我使用POI阅读,处理它们,并创建一个新的Excel报告.
excel文件中的一列具有总花费的时间,也就是说,它可以采用以下格式,46:23:12
- 读为46 hours, 23 minutes and 12 seconds
.
我理解如何读取日期和时间值,我通常将它们存储在中java.util.Date
.这里的问题是这是一个持续时间,花费的时间可能超过24.哪种数据类型适合这个?我如何使用POI阅读此内容?
java ×5
selenium ×2
apache-poi ×1
dependencies ×1
duration ×1
file-upload ×1
jtable ×1
maven ×1
multipart ×1
post ×1
swing ×1
time ×1
unirest ×1
webdriver ×1