0

以下是我的网页表格...

        <div class="padding">
            <span class="new-line forty-six-bottom smaller">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam nec arcu id enim tincidunt vulputate. Sed et elementum nisi. Donec rhoncus feugiat pharetra. Donec sed augue id urna congue commodo et quis nulla. </span>
            <form id="detailsForm" action="/xyz/home/personaldetails" method="post">
             <span class="new-line fifteen-bottom">     
                <label for="title">
                    Title:
                </label>
                <em>*</em>
                <span class="field-and-error">

                <select id="title" name="title" class="required" style="width:234px;">
                    <option value="">Please select</option>
                    <option value="Mr" selected="selected">Mr</option><option value="Mrs">Mrs</option><option value="Miss">Miss</option><option value="Dr">Dr</option><option value="Ms">Ms</option><option value="Sir">Sir</option><option value="Prof">Prof</option><option value="Dame">Dame</option><option value="Lord">Lord</option><option value="Lady">Lady</option><option value="RH">RH</option><option value="Rev">Rev</option><option value="Sister">Sister</option><option value="Father">Father</option><option value="Other">Other</option>

                </select>

                </span>
            </span>
            <span class="new-line fifteen-bottom">  
                <label for="firstName">
                    First name:
                </label>
                <em>*</em>
                <span class="field-and-error">

                <input id="firstName" name="firstName" type="text" value="Sivaji" maxlength="50"/>

                </span>
            </span>
            <span class="new-line fifteen-bottom">      
                <label for="lastName">
                    Last name:
                </label>
                <em>*</em>
                <span class="field-and-error">

                <input id="lastName" name="lastName" type="text" value="Ganesan" maxlength="50"/>

                </span>
            </span>
When I copy the xpath from the above HTML, i am getting //*[@id="firstName"].

我正在尝试使用

selenium.type("//input[@id='firstName']", "Chandra");或者

selenium.type("//*[@id='firstName']", "Chandra");

我正进入(状态

`12:28:37.854 INFO - Got result: ERROR: Element //input[@id='firstName'] not found on 

session 96a10231817c40e5aa370660fd05ba45`

任何人都可以澄清为什么它不能识别吗?同样的,如果我在 IDE 中录制,我可以实现,但在 RC 中我不能。

谢谢钱德拉

4

1 回答 1

0

下面的代码使用给定的 html 代码片段工作得非常好。

selenium.type("//*[@id='firstName']", "SantoshSarma");
于 2012-12-28T18:24:30.923 回答