我正在尝试将stdout复制到文件以进行日志记录.我还希望它显示在我正在使用的IDE的Ruby控制台中.
我将此代码插入到我的脚本中,然后重定向$stdout到my.log文件:
$stdout.reopen("my.log", "w")
Run Code Online (Sandbox Code Playgroud)
有没有人知道将内容复制$stdout到文件而不是将其重定向到文件的gem或技术?另外,我没有使用Rails只是Ruby.
所以我在页面上有一个输入元素,我需要点击它去另一个页面.问题是,当我在元素上单击click()或submit()时,没有任何反应.我有一个自定义突出显示方法,所以我可以看到我实际上是正确的元素.由于某些未知原因,click()似乎没有在它上面工作.
这是我正在使用的HTML
<TBODY>
<TR style="" class=" STDLISTROW_O" onmouseover=listMouseOver(this); onmouseout=listMouseOut(this); saveBG>
<TD class=STDLISTBTN>
<INPUT style="COLOR: " onmouseover="listBtnMouseOver(this); window.status = this.status_txt;" onmouseout="listBtnMouseOut(this); window.status = '';" onclick=" event.cancelBubble = true; if (this.getAttribute('clicked') == 'false') { document.location.href = 'client$.startup?P_CLIENT_ID=7605677'; this.setAttribute('clicked', 'true'); } " value=ECR type=button status_txt="client$.startup?P_CLIENT_ID=7605677" clicked="false" saveBtnBG saveBtnC></TD>
Run Code Online (Sandbox Code Playgroud)
这是我的Selenium/Java方法
public void clickECRButtonWithID(String clientID) {
log.info("Click the ECR button for the row with client id: " + clientID);
WebElement idRow = driver.findElement(By.xpath("//td[contains(text(),'"
+ clientID + "')]/ancestor::tr"));
WebElementExtender.highlightElement(idRow);
WebElement ecrButton = driver.findElement(By.cssSelector("input[value='ECR']"));
WebElementExtender.highlightElement(ecrButton);
ecrButton.click();
} …Run Code Online (Sandbox Code Playgroud) 我正在为新的企业应用程序创建自动化框架。我正在使用Selenium(Webdriver),Java,Maven和TestNG。我已经读到我需要保持测试的规模小和自治,以便可以彼此独立地运行它们。
登录到应用程序是最耗时的过程。如果我必须登录并为每个测试重新开始,这会使我的测试套件运行一段时间。同样,如果我已经登录并导航到应用程序的特定部分,那么我不妨执行一些测试,而不是在一次测试后关闭浏览器并每次重新导航。
我应该坚持简短的自主测试,还是寻找其他构建测试的方法?
testing testng selenium browser-automation selenium-webdriver