• <bdo id='frI1d'></bdo><ul id='frI1d'></ul>
  • <tfoot id='frI1d'></tfoot>

    <i id='frI1d'><tr id='frI1d'><dt id='frI1d'><q id='frI1d'><span id='frI1d'><b id='frI1d'><form id='frI1d'><ins id='frI1d'></ins><ul id='frI1d'></ul><sub id='frI1d'></sub></form><legend id='frI1d'></legend><bdo id='frI1d'><pre id='frI1d'><center id='frI1d'></center></pre></bdo></b><th id='frI1d'></th></span></q></dt></tr></i><div id='frI1d'><tfoot id='frI1d'></tfoot><dl id='frI1d'><fieldset id='frI1d'></fieldset></dl></div>

      <small id='frI1d'></small><noframes id='frI1d'>

      <legend id='frI1d'><style id='frI1d'><dir id='frI1d'><q id='frI1d'></q></dir></style></legend>
      1. 如何通过Selenium和C#保存通过SendKeys()方法发送的字符序列

        时间:2023-09-13
      2. <tfoot id='Zrefq'></tfoot>
            <legend id='Zrefq'><style id='Zrefq'><dir id='Zrefq'><q id='Zrefq'></q></dir></style></legend>
              <bdo id='Zrefq'></bdo><ul id='Zrefq'></ul>

                  <tbody id='Zrefq'></tbody>

                  <small id='Zrefq'></small><noframes id='Zrefq'>

                  <i id='Zrefq'><tr id='Zrefq'><dt id='Zrefq'><q id='Zrefq'><span id='Zrefq'><b id='Zrefq'><form id='Zrefq'><ins id='Zrefq'></ins><ul id='Zrefq'></ul><sub id='Zrefq'></sub></form><legend id='Zrefq'></legend><bdo id='Zrefq'><pre id='Zrefq'><center id='Zrefq'></center></pre></bdo></b><th id='Zrefq'></th></span></q></dt></tr></i><div id='Zrefq'><tfoot id='Zrefq'></tfoot><dl id='Zrefq'><fieldset id='Zrefq'></fieldset></dl></div>

                  本文介绍了如何通过Selenium和C#保存通过SendKeys()方法发送的字符序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  Selenium c# 在我的测试网站的文本框中输入数据时,光标位置设置为中间,输入的数据类似于例如3421 而不是 1234 的正确顺序.

                  Selenium c# when entering data in a Textbox for My Test Website the the cursor position is set to the Middle and the data entered is like for e.g. 3421 instead of the correct Order of 1234.

                  任何人都可以提出一个如何处理这个问题的好方法吗?

                  Can anyone suggest a good way as to how to handle this?

                  我曾尝试使用按 HOME 键按钮,但没有成功.

                  I have tried to Use pressing the HOME key button but it did not work.

                  推荐答案

                  通过发送的字符序列的顺序不持久性背后的实际问题很难预测SendKeys() 方法在没有相关 HTML 的情况下.

                  It would be tough to predict the actual issue behind the non perseverance of the sequential order of the character sequence sent through SendKeys() method in absence of the relevant HTML.

                  但是,如果 AUT(被测应用程序) 是 JavaScript, Angular 或 ReactJS基于 ,根据 最佳实践,您需要诱导 WebDriverWait 以使所需的 元素可点击,然后您需要调用 Clear() 方法,最后调用 SendKeys() 方法如下:

                  However, in case the AUT (Application Under Test) is JavaScript, Angular or ReactJS based, as per best practices you need to induce WebDriverWait for the desired element to be clickable, then you need to invoke Clear() method and finally invoke SendKeys() method as follows:

                  • C#:

                  IWebElement textBoxElement = new WebDriverWait(driver, TimeSpan.FromSeconds(10)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("xpath_of_HOME_key_button")));
                  textBoxElement.Click();
                  textBoxElement.Clear();
                  textBoxElement.SendKeys("1234");
                  

                  这篇关于如何通过Selenium和C#保存通过SendKeys()方法发送的字符序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在 C# 中使用 Firefox 启动特定 URL 下一篇:如何使用 Selenium WebDriver + C# 获取浏览器控制台错误消息

                  相关文章

                • <legend id='ekkhn'><style id='ekkhn'><dir id='ekkhn'><q id='ekkhn'></q></dir></style></legend>

                    <small id='ekkhn'></small><noframes id='ekkhn'>

                    <tfoot id='ekkhn'></tfoot>
                  1. <i id='ekkhn'><tr id='ekkhn'><dt id='ekkhn'><q id='ekkhn'><span id='ekkhn'><b id='ekkhn'><form id='ekkhn'><ins id='ekkhn'></ins><ul id='ekkhn'></ul><sub id='ekkhn'></sub></form><legend id='ekkhn'></legend><bdo id='ekkhn'><pre id='ekkhn'><center id='ekkhn'></center></pre></bdo></b><th id='ekkhn'></th></span></q></dt></tr></i><div id='ekkhn'><tfoot id='ekkhn'></tfoot><dl id='ekkhn'><fieldset id='ekkhn'></fieldset></dl></div>
                      • <bdo id='ekkhn'></bdo><ul id='ekkhn'></ul>