Hướng dẫn how do you double click element in python selenium? - làm thế nào để bạn nhấp đúp vào phần tử trong python selen?

Tôi đang sử dụng selenium với Python. Tôi có thể lấy mã bên dưới để nhấp vào nơi tôi muốn nhưng tôi muốn nó nhấp vào DBL. Tôi không giỏi lắm với các chuỗi hành động và tôi biết tôi cần điều đó để nhấp DBL. Bất cứ ai có thể giúp đỡ với những gì tôi cần thay đổi xung quanh?

user = self.find_element_by_id["selUsers"]
for option in user.find_elements_by_tag_name["option"]:
    if option.text == "Admin, Ascender":
         option.click[]

Đã hỏi ngày 25 tháng 7 năm 2013 lúc 23:34Jul 25, 2013 at 23:34

Chuỗi hành động là lựa chọn tốt nhất duy nhất mà tôi biết

from selenium.webdriver.common.action_chains import ActionChains

driver=self.webdriver
user = self.find_element_by_id["selUsers"]
for option in user.find_elements_by_tag_name["option"]:
   if option.text == "Admin, Ascender":
      actionChains = ActionChains[driver]
      actionChains.double_click[option].perform[]

Đã trả lời ngày 20 tháng 12 năm 2013 lúc 6:43Dec 20, 2013 at 6:43

thử cái này:

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from time import sleep
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains

usernameStr = 'xxxxxx'
passwordStr = 'xxxxx'

browser = webdriver.Chrome[]
browser.get[['//accounts.google.com/ServiceLogin?'
         'service=mail&continue=//mail.google'
         '.com/mail/#identifier']]


username = browser.find_element_by_id['identifierId']
username.send_keys[usernameStr]
nextButton = browser.find_element_by_id['identifierNext']

nextButton.click[]

# wait for transition then continue to fill items
password = WebDriverWait[browser, 10].until[EC.presence_of_element_located[[By.XPATH,'//*    [@id="password"]/div[1]/div/div[1]/input']]]

password.send_keys[passwordStr]

signInButton = browser.find_element_by_id['passwordNext']
signInButton.click[]

apsButton = WebDriverWait[browser, 10].until[EC.presence_of_element_located[[By.XPATH,'//[@id="gbwa"]/div/a']]]

apsButton.click[]
driveButton = WebDriverWait[browser, 10].until[EC.presence_of_element_located[[By.XPATH,'//*[@id="gb49"]/span[1]']]]
driveButton.click[]

Đã trả lời ngày 7 tháng 9 năm 2019 lúc 19:09Sep 7, 2019 at 19:09

Xem thảo luận

Cải thiện bài viết

Lưu bài viết

  • Đọc
  • Bàn luận
  • Xem thảo luận

    Cải thiện bài viết

    Lưu bài viết

    Đọc
    This article revolves around double_click method on Action Chains in Python Selenium. double_click method is used to double click on an element or current position.

    Bàn luận

    double_click[on_element=None]

    Mô -đun Selenium sườn Python được xây dựng để thực hiện thử nghiệm tự động với Python. ActionChain là một cách để tự động hóa các tương tác cấp thấp như chuyển động chuột, hành động nút chuột, Keypress và Tương tác menu ngữ cảnh. Điều này rất hữu ích để thực hiện các hành động phức tạp hơn như di chuột qua và kéo và thả. Các phương thức chuỗi hành động được sử dụng bởi các tập lệnh nâng cao trong đó chúng ta cần kéo một phần tử, nhấp vào một phần tử, nhấp chuột gấp đôi, v.v. Bài viết này xoay quanh phương thức double_click trên chuỗi hành động trong Python selenium. Phương thức double_click được sử dụng để nhấp đúp vào một phần tử hoặc vị trí hiện tại.
    on_element – The element to click. If None, clicks on current mouse position.

    Cú pháp -

    Args, ____________ 6 - yếu tố để nhấp. Nếu không có, nhấp vào vị trí chuột hiện tại.

    Thí dụ -

    Bài Viết Liên Quan

    Chủ Đề