我将测试一个网络应用程序.我的表格中有一个按钮可供选择所有条目.我试过了:
driver.wait.until(ExpectedCondition.element_to_be_clickable((By.XPATH, "myXpath"))).click()
Run Code Online (Sandbox Code Playgroud)
selenium点击按钮,但没有任何反应.(还有send_Keys(Keys.Return))应用程序是用GXT开发的,我的事情是按钮背后有很多javascript.是否有可能等到事件加载器准备好了?在点击之前等待解决问题,但不是自动化测试的解决方案.
我想要一个用于测试与服务器的连接并返回状态消息的webapp。单击开始按钮后,我想每4秒轮询一次并返回一个状态文本。但是,如果我单击按钮,它将仅自动返回,而不会返回。这是我的代码:
index.xhtml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h1>My App</h1>
<h:form onkeypress="poll.stop()">
Server URL: <h:inputText id="name" value="#{helloBean.name}"></h:inputText>
<p:commandButton value="Start Watching!" onclick="poll.start()" />
<pre><h:outputText id="output" value="#{helloBean.playground}" /></pre>
<p:poll interval="4" listener="#{helloBean.getPlayground}" update="output" widgetVar="poll" autoStart="false" />
</h:form>
</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)
还有我的豆子:
@ManagedBean
@SessionScoped
public class HelloBean implements Serializable {
public String getPlayground(){
if(name.length() < 3){
return "";
}
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy hh:mm:ss");
Date date = new Date();
String …Run Code Online (Sandbox Code Playgroud)