无法使用Selenium

时间:2016-03-23 23:29:34

标签: jquery css selenium xpath

我很抱歉找到你这些简单操作的帮助,但我确实用尽了所有的工具试图解决这个问题。我试过通过部分xpath,完整的xpath,各种css选择器进行定位。

我想知道如何找到这个与jquery相关并与之交互的元素。

相关页面部分的HTML如下:

<fieldset>
    <legend class="hidden_visually">Choose Your Reload Amount</legend>
    <div class="predefined_amount_selector">

    <div id="Predefined_Reload_Amount">
        <ol class="selector numbers form">
                <li>
<input aria-labelledby="defined-amount-label_0" class="radio" id="defined-amount_0" name="defined_amount" title="$10" type="radio" value="10" />
                    <label for="defined-amount_0" id="defined-amount-label_0" class="">$10</label>
                </li>
                <li>
<input aria-labelledby="defined-amount-label_1" checked="checked" class="radio" id="defined-amount_1" name="defined_amount" title="$25" type="radio" value="25" />
                    <label for="defined-amount_1" id="defined-amount-label_1" class="">$25</label>
                </li>
                <li>
<input aria-labelledby="defined-amount-label_2" class="radio" id="defined-amount_2" name="defined_amount" title="$50" type="radio" value="50" />
                    <label for="defined-amount_2" id="defined-amount-label_2" class="">$50</label>
                </li>
                <li>
<input aria-labelledby="defined-amount-label_3" class="radio" id="defined-amount_3" name="defined_amount" title="$100" type="radio" value="100" />
                    <label for="defined-amount_3" id="defined-amount-label_3" class="">$100</label>
                </li>
        </ol>
        <p class="note">Or enter your own amount &raquo;</p>
    </div>

    <noscript>
        <p>Enter the amount you'd like to load on this card.</p>
    </noscript>

    <div id="Manual_Reload_Amount">
        <ol class="form form_full">
            <li  id="min_max_amount" data-min="5" data-max="100">
                    <span class="numbers">$</span>

<input class="field_small numbers align_right" data-validation-max="100" data-validation-min="10" id="reload_amount" maxlength="10" name="Amount" title="Please enter an amount." type="text" value="25" />
                <span>$10 to $100</span>

            </li>
        </ol>
        <p class="note">Or choose an amount &raquo;</p>
    </div>
</div>

</fieldset>

1 个答案:

答案 0 :(得分:1)

您需要使用jquery执行此操作。我为你准备了一个样品

https://jsfiddle.net/max234435/ro50jw14/

您只需将选择器更改为您尝试访问的段落