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

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

    1. 无法使用 selenium webdriver 的 gettext() 从文本框中读

      时间:2023-10-12

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

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

          <tfoot id='JQwhd'></tfoot>

              <tbody id='JQwhd'></tbody>

            <legend id='JQwhd'><style id='JQwhd'><dir id='JQwhd'><q id='JQwhd'></q></dir></style></legend>
                本文介绍了无法使用 selenium webdriver 的 gettext() 从文本框中读取文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                选择日期后,我无法从 ajax 日历控件中读取日期

                I can't read dates from ajax calendar control after date selection

                http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Calendar/日历.aspx

                我没有收到任何错误,但我无法从文本框中获取任何值.

                I don't get any error but I can't fetch any value from textbox.

                public static void main(String[] args) throws InterruptedException {
                
                        WebDriver driver = new FirefoxDriver();
                        driver.get("http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Calendar/Calendar.aspx");
                        driver.manage().window().maximize();
                
                
                        //Default calendar: 
                        driver.findElement(By.xpath("//*[@id='ctl00_SampleContent_Date1']")).click();
                
                        for(int i=0;i<=5;i++){
                
                            for(int j = 0;j<=6;j++){
                
                                System.out.print(driver.findElement(By.xpath("//*[@id='ctl00_SampleContent_defaultCalendarExtender_day_"+i+"_"+j+"']")).getText()+"-");
                
                            }
                            System.out.println();
                        }
                
                        driver.findElement(By.xpath("//*[@id='ctl00_SampleContent_defaultCalendarExtender_day_3_4']")).click();
                
                        System.out.println(driver.findElement(By.xpath("//*[@id='ctl00_SampleContent_Date1']")).getText());
                
                
                        //Calendar with an associated button:
                
                        System.out.println("Calendar with an associated button:------------------------------------------------------");
                
                        driver.findElement(By.xpath("//*[@id='ctl00_SampleContent_Image1']")).click();
                
                        for(int i=0;i<=5;i++){
                
                            for(int j = 0;j<=6;j++){
                
                                System.out.print(driver.findElement(By.xpath("//*[@id='ctl00_SampleContent_calendarButtonExtender_day_"+i+"_"+j+"']")).getText()+"-");
                
                            }
                            System.out.println();
                        }
                
                        Thread.sleep(5000L);
                        driver.findElement(By.xpath("//*[@id='ctl00_SampleContent_Image1']")).click();
                        driver.findElement(By.xpath("//*[@id='ctl00_SampleContent_calendarButtonExtender_day_3_3']")).click();
                
                        System.out.println(driver.findElement(By.xpath("//*[@id='ctl00_SampleContent_Date5']")).getText());
                
                
                    }
                

                推荐答案

                获取 input 文本的调用应该是:

                The call to get the input text should be:

                driver.findElement(By.id("ctl00_SampleContent_Date5")).getAttribute("value");
                

                别问我为什么,就是这样一直是.通过键入 input 元素,您正在更改其 value 属性.

                Don't ask me why, it's just the way it always has been. By typing into an input element, you are changing its value attribute.

                这篇关于无法使用 selenium webdriver 的 gettext() 从文本框中读取文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:Selenium WebDriver 点击隐藏元素 下一篇:使用JS输入文字,但是如果我在一个文本框中输入

                相关文章

                最新文章

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

                    • <bdo id='FpfeP'></bdo><ul id='FpfeP'></ul>
                  1. <small id='FpfeP'></small><noframes id='FpfeP'>

                    <tfoot id='FpfeP'></tfoot>