我正在尝试单击页面“http://parcelhero.ennovatesoftware.net/shipment/quote?Q=93,,207,,1,1,2,3,1,postcode,cms,kgs,N,postcode,,,1&p=&s=”上的按钮(“立即购买”)并获取“元素不可见”错误,但当我尝试访问同一元素的属性时,它会获得访问没有任何错误。那么在访问同一元素的属性时,如何看到点击时不可见的元素?
以下是代码:
let i = 0; //it's global to the loop, ( wider scope )
while (i<=x) {
//Code line;
//Code line;
//Code line;
//Code line;
i++
}
答案 0 :(得分:0)
该按钮在可见之前存在于DOM中,因此您可以找到该按钮并提取属性信息,但不能单击它。使用显式等待Expected Conditions等待所有项目可见
public class LambdaFunctionHandler implements RequestHandler<Object, Object> {
@Override
public Object handleRequest(AwsProxyRequest input, Context context) {
String resourcePath = input.getRequestContext().getResourcePath();
return resourcePath;
}
}
public class AwsProxyRequest {
//-------------------------------------------------------------
// Variables - Private
//-------------------------------------------------------------
private ApiGatewayRequestContext requestContext;
....
//-------------------------------------------------------------
// Methods - Getter/Setter
//-------------------------------------------------------------
public ApiGatewayRequestContext getRequestContext() {
return requestContext;
}
public void setRequestContext(ApiGatewayRequestContext requestContext) {
this.requestContext = requestContext;
}
....
}
public class ApiGatewayRequestContext {
//-------------------------------------------------------------
// Variables - Private
//-------------------------------------------------------------
private String resourcePath;
...
//-------------------------------------------------------------
// Methods - Getter/Setter
//-------------------------------------------------------------
public String getResourcePath() {
return resourcePath;
}
public void setResourcePath(String resourcePath) {
this.resourcePath = resourcePath;
}
....
}