【发布时间】:2019-03-30 10:14:11
【问题描述】:
两个测试单独工作都很好我需要帮助将它们合并。
我无法同时测试两者。
如果工作表单元格被读取为男性,则应单击男性单选按钮。
请帮我解决这个测试
ExcelRead33.java 将从 Excel 表中读取特定单元格。
facebookradio.java 将在单选按钮上运行测试。
用于数据的 Excel 文件。
package testpoi;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class facebookradio {
public static void main(String[] args) throws Exception {
WebDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.get("http://www.facebook.com");
WebElement male_radio_button=driver.findElement(By.id("u_0_a"));
male_radio_button.click();
WebElement female_radio_button=driver.findElement(By.id("u_0_9"));
female_radio_button.click();
ExcelRead33.java 将从 Excel 表中读取特定单元格。
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
//How to read excel files using Apache POI
public class ExcelRead33 {
public static void main (String [] args) throws IOException{
FileInputStream fis = new FileInputStream("C:/DDFREAD.xlsx");
XSSFWorkbook workbook = new XSSFWorkbook(fis);
XSSFSheet sheet = workbook.getSheetAt(1);
//Read specific row and column
Row row = sheet.getRow(2);
Cell cell = row.getCell(8);
//This will print data which I want to click
System.out.println(cell);
【问题讨论】:
-
我认为您的意思是“无法”而不是“不可用”。请在原始帖子中显示您的尝试以及您的代码清单以及您尝试时遇到的错误。
标签: java selenium selenium-webdriver radio-button apache-poi