簡體   English   中英

硒,如何按ENTER鍵,無元素

[英]Selenium, how to press ENTER key, no element

我正在使用firefox selenium插件,無法確定在粘貼一些文本后發送回車鍵。 按下此ENTER鍵是“否/否/否”,可以在頁面上的其他任何位置(即,沒有元素開關)進行按下。 只是按下一個“啞” ENTER鍵?

錯誤

[error] Element name=code not found

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://www.facebook.com/" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
    <td>open</td>
    <td>/br.rall/posts/10153787412985552?comment_id=10153787988345552&amp;reply_comment_id=10153788588305552&amp;notif_t=feed_comment</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>//div[@id='js_k']/div[5]/div/textarea</td>
    <td>In recent history, the phrase is most closely identified with critics of the economic policies known as &quot;Reaganomics&quot;. David Stockman, who as Reagan's budget director championed Reagan's tax cuts at first, but then became critical of them, told journalist William Greider that the &quot;supply-side economics&quot; is the trickle-down idea: &quot;It's kind of hard to sell 'trickle down,' so the supply-side formula was the only way to get a tax policy that was really 'trickle down.' Supply-side is 'trickle-down' theory.&quot;[4][5] Political opponents of the Reagan administration soon seized on this language in an effort to brand the administration as caring only about the wealthy.[6]</td>
</tr>
<tr>
       <td>sendKeys</td>
       <td></td>
       <td>${KEY_ENTER}</td>
</tr>

</tbody></table>
</body>
</html>

如何在“文本粘貼”之后直接按ENTER鍵而不跳轉元素?

您可以將Enter鍵發送到body標簽-每個頁面都應該有一個,但是它不應觸發任何特定的元素。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM