找不到按钮元素C# [英] Cannot find button element C#

查看:110
本文介绍了找不到按钮元素C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

硒找不到元素登录".我浏览了与此有关的其他stackoverflow问题,但似乎并没有完全解决.

Selenium cannot find the element "Log in". I looked through the other stackoverflow questions regarding this and didn't seem to completely resolve.

// C#
IWebElement submit = driver.FindElement(By.Name("Log in"));
submit.Click();

// html
<div class="btn-group pull-right">
<button class="btn btn-success shadow" type="submit">Log in</button>
</div>

推荐答案

尝试driver.FindElement(By.XPath("//button[@type='submit'][text()='Log in']")

这篇关于找不到按钮元素C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆