摘要: 我更喜欢使用扩展方法来获取脚本对象: public static IJavaScriptExecutor Scripts(this IWebDriver driver){ return (IJavaScriptExecutor)driver;} 用作: driver.Scripts().Execut 阅读全文
posted @ 2021-08-03 14:45 左正 阅读(665) 评论(0) 推荐(0) 编辑
摘要: 以东方财富网登录页面为例: 在查找元素过程中,直接通过id或者xpath等找不到元素,查看页面源代码发现元素是属于iframe里,例如: <div class="wrap_login"> <iframe class="frame_login" src="https://exaccount.eastm 阅读全文
posted @ 2021-08-03 14:32 左正 阅读(741) 评论(0) 推荐(0) 编辑
摘要: 使用Selenium WebDriver驱动浏览器测试的过程中多多少少会遇到一些折腾人的问题,总结了一部分,做下分享。 一、隐藏元素处理(element not visible) 使用WebDriver点击界面上被隐藏的元素时,使用默认的IWebElement.Click()方法可能无法触发Clic 阅读全文
posted @ 2021-08-03 14:32 左正 阅读(416) 评论(0) 推荐(0) 编辑
摘要: 在使用selenium进行自动化登录的过程中已经获取到cookie后,依旧报错:selenium.common.exceptions.InvalidCookieDomainException: Message: invalid cookie domain 获取cookie和添加cookie原代码如下 阅读全文
posted @ 2021-08-03 14:14 左正 阅读(336) 评论(0) 推荐(1) 编辑