Tag: 自动化测试

编码的UI – C# – time itemprop标签 – 如何validation年份存在

我昨天在一个稍微不同的问题上得到了@dlatikay的帮助,这帮助我部分解决了误报。 这是代码片段: string countCurrentYearQA = (string)(window.ExecuteScript(“count = 0; if(document.body.innerText.toString().indexOf(‘” + nowYearQAString + “‘) > -1){count = 1;} return count.toString();”)); string countPastYearQA = (string)(window.ExecuteScript(“count = 0; if(document.body.innerText.toString().indexOf(‘” + pastYearQAString + “‘) > -1){count = 1;} return count.toString();”)); string countCurrentYearQAWithoutEndPipe = (string)(window.ExecuteScript(“count = 0; if(document.body.innerText.toString().indexOf(‘” + nowYearQAStringWithoutPipe + “‘) > -1){count = 1;} return count.toString();”)); string countPastYearQAWithoutEndPipe […]

PhantomJS并单击表单按钮

我有一个非常简单的HTML表单,我试图用各种数据进行测试。 我使用IE对象在MS Access / VBA中编写了一个原型概念validation。 它工作正常,但完成的测试产品必须使用PhantomJS。 我有页面连接工作,表单填充得很好。 我被困的地方是让提交按钮开火。 我已经梳理了SO并尝试了所有建议,但没有任何工作。 我正在使用PhantomJS 1.9.7并使用直接的JavaScript测试脚本。 我尝试了各种JavaScript技术来触发提交按钮。 为了满足“Just use JQuery”的用户群,我也试过了。 没有什么工作。 当我在测试脚本的末尾渲染表单时,我看到填充了数据的表单耐心地等待点击按钮。 以下是我尝试过的摘要: document.getElementById(‘btnSearch’).click(); $(“btnSearch”).click(); var el = document.getElementById(‘btnSearch’); // Get search button object $(el).click(); document.getElementById(‘Form1’).submit(); 尝试创建一个click事件并从按钮对象中触发它(在下面的代码中) 尝试创建一个click事件并使用相关按钮内部点的坐标从body对象中触发它 以下是表格:(并且请不要对缺乏CSS,使用表格等进行评论/辩论。我对创建网站的人没有任何发言权或影响力。) Da Site Street Address: City: State: AL – Alabama AK – Alaska [The rest of the other states] WI – Wisconsin […]