使用java在webdriver中获取输入标记id和值

使用java在webdriver中获取输入标记id和值,java,selenium,Java,Selenium,Html 以下是我的预期输出 id=chkRenewal_868 value=868文档格式不好,我不知道这对webdriver是否重要, 但是XPath必须是 WebElement inputValues = driver.findElement(By .xpath("//*[@id='tblRenewalList']/tbody/tr[1]/td[1]")); String idValue = inputValues.getAt

Html

以下是我的预期输出

id=chkRenewal_868
value=868

文档格式不好,我不知道这对webdriver是否重要, 但是XPath必须是

WebElement inputValues = driver.findElement(By
                    .xpath("//*[@id='tblRenewalList']/tbody/tr[1]/td[1]"));
            String idValue = inputValues.getAttribute("id");
            String ed2 = inputValues.getAttribute("value");

感谢将更改X路径,获得我的预期
WebElement inputValues = driver.findElement(By
                    .xpath("//*[@id='tblRenewalList']/tbody/tr[1]/td[1]"));
            String idValue = inputValues.getAttribute("id");
            String ed2 = inputValues.getAttribute("value");
//*[@id='tblRenewalList']/tbody/tr[1]/td[1]/input