【问题标题】:Can't able to select a specific list that I want in Selenium + C#无法在 Selenium + C# 中选择我想要的特定列表
【发布时间】:2018-12-27 07:45:38
【问题描述】:

实际上,我想在容器中选择我想要的特定列表。但我尝试用下面的代码写,但它没有反映:

Actions actions = new Actions(driver);

IWebElement mainMenu = driver.FindElement(By.XPath("//*[@id='requestItemSFHD-24']"));

actions.MoveToElement(mainMenu).Build().Perform();

actions.MoveToElement(mainMenu).Click();

谁能帮我解决这个问题?谢谢。

enter image description here

【问题讨论】:

  • 实际上你想做什么?你能描述一下用例吗?
  • 假设您在一个容器中有 5 个值。您想从容器中选择 3 个还是 4 个值?
  • @RatmirAsanov 我想选择一个包含在容器内的请求来检查它是否会重定向到显示正确信息的页面
  • @AshokkumarGanesan 正是我想要的
  • 能否提供更多关于 DOM 结构和截图的信息。尝试在问题本身中插入屏幕截图,而不是作为链接提供。

标签: c# selenium automation webdriver nunittestadapter


【解决方案1】:
Actions actions = new Actions(driver);
IWebElement mainMenu = driver.FindElement(By.ClassName("requestItem-target"));
actions.MoveToElement(mainMenu).Build().Perform();
driver.FindElements(By.ClassName("requestItem-target")).ElementAt(1).Click();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-21
    • 2019-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-29
    • 2015-05-19
    相关资源
    最近更新 更多