c# - 单击使用 Selenium C# 的 Google 表单测验 ViewScore 按钮
问题描述
我曾尝试单击最后一个按钮以使用 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 岁)
解决方案
看看这是否适用于使用链接的文本?
<span class="appsMaterialWizButtonPaperbuttonLabel quantumWizButtonPaperbuttonLabel exportLabel">Преглед на оценката</span>
driver.FindElement(By.Xpath("//span[contains(text(), 'Преглед на оценката')]")).Click();
推荐阅读
- python-3.x - 谁能解释为什么我不能连接这两个矩阵?
- java - 过渡后第一个片段保留在后台
- javascript - 如何在 Quasar 中添加自定义属性?
- python - Python Selenium 只找到页面上的第一个元素
- git - 将项目上传到现有项目
- typescript - 类或子类的所有索引的类型
- javascript - react native 中的解析模块 fs 出错
- firebase - 在后端数据库中编码用户定义的排序顺序的明智方法?
- reactjs - TypeScript 没有忽略 node_modules 库
- docker - Travis 上的 Docker 构建失败 --> 找不到应用程序/构建