按钮被单击,但不';不要进入另一页-Selenium
这很奇怪。按钮已单击,但不会重定向到其他页面 这是我的方法:按钮被单击,但不';不要进入另一页-Selenium,selenium,selenium-webdriver,webdriver,selenium-ide,Selenium,Selenium Webdriver,Webdriver,Selenium Ide,这很奇怪。按钮已单击,但不会重定向到其他页面 这是我的方法: driver.FindElement(By.XPath("(.//*[normalize-space(text()) and normalize-space(.)='Phone Number'])[1]/following::button[1]")).Click(); 或 此按钮在HTML中的显示方式: <div _ngcontent-c4="" class="col-xs-12 no-padding-sides">
driver.FindElement(By.XPath("(.//*[normalize-space(text()) and normalize-space(.)='Phone Number'])[1]/following::button[1]")).Click();
或
此按钮在HTML中的显示方式:
<div _ngcontent-c4="" class="col-xs-12 no-padding-sides">
<div _ngcontent-c4="" class="col-xs-8 col-xs-offset-4 no-padding-sides bottom-actions">
<button _ngcontent-c4="" class="btn custom-btn custom-blue" type="submit"> Proceed </button>
<button _ngcontent-c4="" class="btn custom-btn custom-grey" type="button"> Cancel</button></div>
</div>
继续
取消
注意:我在selenium IDE和selenium webdriver上测试了相同的场景,它们都有相同的问题。您试过了吗
var Proceed = driver.FindElement(By.XPath("//button[contains(.,'Proceed')]"));
或
如果这些不起作用,请发布更多的HTML。如何确保按钮被单击?你确定吗?我只是尝试单击带有空字段的按钮,并检查了验证,工作正常如果你正在尝试填写表单,然后继续下一页,出于调试目的,请在填写表单和单击按钮之间放置一些等待/暂停。还要确保填充表单时DOM没有改变,确保空表单和填充表单具有相同的按钮定位器。在这里没有答案之前,什么都不起作用
var Proceed = driver.FindElement(By.XPath("//button[contains(.,'Proceed')]"));
var Proceed = driver.FindElement(By.XPath("//button[@class='custom-blue']"));