zoukankan      html  css  js  c++  java
  • WebDriver API——第4部分Alerts

    The Alert implementation.

    class selenium.webdriver.common.alert.Alert(driver)

    Bases: object

    Allows to work with alerts.

    Use this class to interact with alert prompts. It contains methods for dismissing, accepting, inputting, and getting text from alert prompts.

    Accepting / Dismissing alert prompts:

    Alert(driver).accept()
    Alert(driver).dismiss()
    

    Inputting a value into an alert prompt:

    name_prompt = Alert(driver) name_prompt.send_keys(“Willian Shakesphere”) name_prompt.accept()

    Reading a the text of a prompt for verification:

    alert_text = Alert(driver).text self.assertEqual(“Do you wish to quit?”, alert_text)
    accept()

    Accepts the alert available.

    Usage:: Alert(driver).accept() # Confirm a alert dialog.

    dismiss()

    Dismisses the alert available.

    send_keys(keysToSend)

    Send Keys to the Alert.

    Args:
    • keysToSend: The text to be sent to Alert.
    text

    Gets the text of the Alert.

  • 相关阅读:
    锁,你知多少呢?
    成长于我
    js write google广告
    项目三边六拍
    IT新人培养计划
    网站变灰色 代码
    职业人生
    ASP.NET 4 新特性之一二
    .net 例子
    A Better sp_who2 using DMVs (sp_who3)
  • 原文地址:https://www.cnblogs.com/hushaojun/p/4467475.html
Copyright © 2011-2022 走看看