无法使用getAttribute方法和硒中的Javascript获取值

时间:2019-05-24 06:17:10

标签: selenium-webdriver dom functional-testing data-driven

the element marked i want to get the value to compare it with excel data

@FindBy(id="TAXEI")
//@FindBy(xpath="//*[@id='TAXEI']")
public WebElement taxesEIvalue;


public void verifyTaxesEIvalue() {
    //jse.executeScript("arguments[0].setAttribute('type', '')",taxesEIvalue);

String value=taxesEIvalue.getAttribute("value");
System.out.println("the value is "+value);
}

我在获取应用程序中的值以与excel进行比较时遇到问题,但无法通过Dom结构获得值。Html结构未提供Value属性

这是元素的html代码,无法获取文本框中的值,我已经使用数据驱动将该值与excel数据进行了比较

<div class="col-lg-6 col-md-6 col-sm-6">
                    <fieldset class="fsStyle">
                        <legend class="legendStyle">
                            <label class="control-label main">TAXES</label>
                        </legend>
                        <div class="wages">
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-sm-5">
                                        <label class="control-label">EI</label>
                                    </div>
                                    <div class="col-sm-7">
                                        <input type="text" class="control-label TAX pull-right" id="TAXEI" disabled="disabled">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-sm-5">
                                        <label class="control-label">QPIP</label>
                                    </div>
                                    <div class="col-sm-7">
                                        <input type="text" class="control-label TAX pull-right" id="TAXQPIP" disabled="disabled">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-sm-5">
                                        <label class="control-label">CPP</label>
                                    </div>
                                    <div class="col-sm-7">
                                        <input type="text" class="control-label TAX pull-right" id="TAXCPP" disabled="disabled">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-sm-5">
                                        <label class="control-label">QPP</label>
                                    </div>
                                    <div class="col-sm-7">
                                        <input type="text" class="control-label TAX pull-right" id="TAXQPP" disabled="disabled">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-sm-5">
                                        <label class="control-label">Income Tax</label>
                                    </div>
                                    <div class="col-sm-7">
                                        <input type="text" class="control-label TAX pull-right" id="TAXIT" disabled="disabled">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-sm-5">
                                        <label class="control-label">Quebec Tax</label>
                                    </div>
                                    <div class="col-sm-7">
                                        <input type="text" class="control-label TAX pull-right" id="TAXQTax" disabled="disabled">
                                    </div>
                                </div>
                            </div>
                            <a id="divExemptNamesIncome"></a>
                            <p class="form-control-static"><strong id="divExemptNamesIncome"></strong></p>
                        </div>
                    </fieldset>
                </div>

0 个答案:

没有答案