【问题标题】:Click On The Google Form Quiz ViewScore Button Using Selenium C#单击使用 Selenium C# 的 Google 表单测验 ViewScore 按钮
【发布时间】:2020-05-07 17:54:47
【问题描述】:

我曾尝试单击最后一个按钮以使用 Selenium 查看分数,但它不起作用。我尝试使用 CSSselector。有什么想法会起作用吗?

![1]:https://i.stack.imgur.com/NZ90V.png

try
        {
            var reee = driver.FindElement(By.CssSelector("body > div.freebirdFormviewerViewFormContentWrapper > div:nth-child(2) > div.freebirdFormviewerViewFormCard.exportFormCard > div > div.freebirdFormviewerViewResponseLinksContainer > div > a > span"));
            Actions actions = new Actions(driver);
            actions.MoveToElement(reee);
            Thread.Sleep(2000);
            actions.Click();
            actions.Build().Perform();
        }
        catch
        {
            Console.WriteLine("well not working");
        }

(它适用于提交按钮顺便说一句) (放轻松,我 15 岁)

【问题讨论】:

  • 你能显示按钮的 html 标记吗?
  • <span jsslot="" class="appsMaterialWizButtonPaperbuttonContent exportButtonContent"><span class="appsMaterialWizButtonPaperbuttonLabel quantumWizButtonPaperbuttonLabel exportLabel">Преглед на оценката</span></span>@Dazed

标签: c# selenium-webdriver selenium-firefoxdriver


【解决方案1】:

看看这是否适用于使用链接的文本?

<span class="appsMaterialWizButtonPaperbuttonLabel quantumWizButtonPaperbuttonLabel exportLabel">Преглед на оценката</span>


driver.FindElement(By.Xpath("//span[contains(text(), 'Преглед на оценката')]")).Click();

【讨论】:

  • pastebin.com/kUvUjfJu 这是完整的按钮哈哈。我错过了一些代码。
  • 试试上面的。我只是根据你的html使用了链接的名称。
  • 很遗憾没有工作。我认为它发生得太快了,谷歌表单禁用了按钮,不太确定
  • 在调试模式下运行它并单步执行。这将帮助您确定是否需要在其中添加等待元素。
  • 天哪,我的理论是正确的。 tysm 帮助我!花了3天终于搞定了
猜你喜欢
  • 1970-01-01
  • 2023-04-10
  • 2019-08-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多