Java 使用selenium自动化qlikview图表
我打算使用selenium自动化qlikview页面中显示的图表。由于这些图表在这些页面中作为一个整体作为图像访问,因此很难在这些图表上交互和定位特定元素/文本 Qlikview演示链接:- 将鼠标悬停在图表上的代码:-Java 使用selenium自动化qlikview图表,java,selenium,xpath,selenium-webdriver,qlikview,Java,Selenium,Xpath,Selenium Webdriver,Qlikview,我打算使用selenium自动化qlikview页面中显示的图表。由于这些图表在这些页面中作为一个整体作为图像访问,因此很难在这些图表上交互和定位特定元素/文本 Qlikview演示链接:- 将鼠标悬停在图表上的代码:- Point coordinates = driver.findElement(By.xpath("//div[@id='68']/div[2]/div[2]/img")).getLocation(); Robot robot = new Robot(); robot.mous
Point coordinates = driver.findElement(By.xpath("//div[@id='68']/div[2]/div[2]/img")).getLocation();
Robot robot = new Robot();
robot.mouseMove(coordinates.getX(),coordinates.getY());
Thread.sleep(5000);
String Tooltip = driver.findElement(By.xpath("//div[@class = 'QvHover']/span[2]")).getText();
System.out.println("Tooltip value:- "+Tooltip);
捕获工具提示值的代码:-
Point coordinates = driver.findElement(By.xpath("//div[@id='68']/div[2]/div[2]/img")).getLocation();
Robot robot = new Robot();
robot.mouseMove(coordinates.getX(),coordinates.getY());
Thread.sleep(5000);
String Tooltip = driver.findElement(By.xpath("//div[@class = 'QvHover']/span[2]")).getText();
System.out.println("Tooltip value:- "+Tooltip);
虽然我找到了一种捕获工具提示值的方法,但除此之外,我无法找到其他方法来定位/捕获其他元素,如轴上的标签、折线图、图例等
任何帮助都将被告知下面是使用Java在selenium下使用的Qlickview数据验证代码 第一步。找到qlikview框架
driver.switchTo().frame(driver.findElement(By.className("report_iframe_test")));
第二步。转到qlikview框架下的html元素,该框架在使用IE开发者工具检查元素后显示
driver.findElement(By.id("PageContainer_test"));
driver.findElement(By.id("MainContainer_test"));
在定位qlikview上存在的元素后,例如从高光部分
String id = driver.findElement(By.id("32_test")).getText();
System.out.println("after frame--"+id);
sysout将打印报告元素值,我们可以将其与数据库进行比较,以便进行数据验证