【问题标题】:Scripting a Mouseover and click event编写鼠标悬停和单击事件脚本
【发布时间】:2019-07-12 01:19:59
【问题描述】:

我正在尝试在 Katalon Studio 中编写脚本,我必须将鼠标悬停并单击特定的 div。该元素仅在鼠标悬停在特定 div 上时可用。如果我按顺序运行这两个命令,它将无法正常工作。如果我可以将它们链接起来,我正在工作,例如:

我尝试按顺序步骤定位元素,但效果不佳,我尝试将它们链接起来(如上所示),但语法在 groovy 中不起作用。

WebUI.mouseOver(findTestObject('blah')).click(findTestObject('myElement'))

【问题讨论】:

    标签: click mouseover katalon-studio


    【解决方案1】:

    尝试使用 Selenium 的 Action 类:

    import com.kms.katalon.core.webui.driver.DriverFactory
    import org.openqa.selenium.interactions.Action
    import org.openqa.selenium.interactions.Actions
    
    WebUI.openBrowser("the page")
    WebDriver driver = DriverFactory.getWebDriver() 
    
    Actions builder = new Actions(driver)
    Action howerAndClick = builder.moveToElement("the web element").click().build()
    

    请注意,您可能需要将测试对象转换为测试元素。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-12-12
      • 1970-01-01
      • 2018-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多