<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                操作表單元素分為兩步: 1、定位到這個元素 2、使用`send_keys(value)`向輸入框輸入數據、使用`clear()`清空輸入框的數據、使用`click()`等函數觸發元素的事件。 <br/> **1. 操作輸入框** ```python # 定位到這個元素 inputTag = driver.find_element_by_id('kw') # 使用send_keys(value)向輸入框填充數據 inputTag.send_keys('python') # 使用clear()清空輸入框的數據 inputTag.clear() ``` <br/> **2. 操作checkbox** 因為要選中checkbox標簽,在網頁中是通過鼠標點擊的。因此想要選中checkbox標簽,那么先選中這個標簽,然后執行click事件。 ```python rememberTag = driver.find_element_by_name("rememberMe") rememberTag.click() ``` <br/> **3. 操作按鈕** 操作按鈕有很多種方式。比如單擊、右擊、雙擊等。這里講一個最常用的,就是點擊,直接調用`click`函數就可以了。 ```python inputTag = driver.find_element_by_id('su') inputTag.click() ``` <br/> **4. 操作select元素** select元素不能直接點擊。因為點擊后還需要選中元素,這時候selenium就專門為select標簽提供了一個類`selenium.webdriver.support.ui.Select`,將獲取到的元素當成參數傳到這個類中,創建這個對象,以后就可以使用這個對象進行選擇了。 <br/> 案例:登錄豆瓣 ```python from selenium import webdriver import time driver = webdriver.Chrome() driver.get('https://www.douban.com/') driver.set_window_size(1500, 1200) login_frame = driver.find_element_by_xpath('//div[@class="login"]/iframe') driver.switch_to.frame(login_frame) time.sleep(2) driver.find_element_by_xpath('//li[@class="account-tab-account"]').click() # driver.find_element_by_id('account-form-remember').click() driver.find_element_by_id('username').send_keys('xxxx') driver.find_element_by_id('password').send_keys('xxxx') driver.find_element_by_class_name('btn-account').click() ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看