我一直在使用Selenium WebDriver进行测试,我一直在寻找一个XPath代码来获取HTML元素属性的值作为回归测试的一部分.但我找不到一个好的答案.
这是我的示例html元素:
<div class="firstdiv" alt="testdiv"></div>
Run Code Online (Sandbox Code Playgroud)
我想使用XPath获取"alt"属性的值.我有一个XPath来使用class属性获取div元素,该属性是:
//div[@class="firstdiv"]
Run Code Online (Sandbox Code Playgroud)
现在,我正在寻找一个XPath代码来获取"alt"属性的值.假设我不知道"alt"属性的值是多少.
我正在尝试为我们的客户端应用程序创建一个 e2e 测试,该应用程序使用 amazon cognito 进行登录。我正在尝试按照有关登录的 aws 文档进行操作。我收到网络错误。我不确定这是否是正确的方法。我收到网络错误,因为它可能是通过我们的 VPN 传输的。我应该如何使用 aws 库解决这个问题?下面是我从 AWS 文档中使用的示例代码。
var authenticationData = {
Username : 'username',
Password : 'password',
};
var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails(authenticationData);
var poolData = { UserPoolId : 'us-east-1_ExaMPle',
ClientId : '1example23456789'
};
var userPool = new AmazonCognitoIdentity.CognitoUserPool(poolData);
var userData = {
Username : 'username',
Pool : userPool
};
var cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);
cognitoUser.authenticateUser(authenticationDetails, {
onSuccess: function (result) {
var accessToken = result.getAccessToken().getJwtToken();
/* Use the idToken for Logins Map when …Run Code Online (Sandbox Code Playgroud) 我有一个数据列表,我以这种方式显示在html模板中.
<div>
<a (click)='onClick(this)' someproperty='test'></a>
<a (click)='onClick(this)' someproperty='test'></a>
<a (click)='onClick(this)' someproperty='test'></a>
<a (click)='onClick(this)' someproperty='test'></a>
</div>
Run Code Online (Sandbox Code Playgroud)
我想在每次点击一个项目时动态更改一个属性.但是,Angular将对象显示为未定义.
这是我的组件:
declare var $:any;
export class MyComponent {
onClick(someobject): void {
$(someobject).attr('someproperty','dontTest');//console shows "Undefined"
}
}
Run Code Online (Sandbox Code Playgroud) 我想创建一个自定义属性指令并将其绑定到属性.我计划检索此属性并稍后获取值.
我创建了一个指令:
@Directive({
selector: '[data-url]'
})
export class DocumentURL{
constructor(private el: ElementRef, private renderer: Renderer) { }
}
Run Code Online (Sandbox Code Playgroud)
这是使用该指令的组件:
@Component({
templateUrl: 'some.component.html',
directives: [DocumentURL]
})
Run Code Online (Sandbox Code Playgroud)
这是我的some.component.html:
<div class="col-xs-6" [data-url]='docUrl' (mouseleave)='onMouseLeave($event)'>
Run Code Online (Sandbox Code Playgroud)
但是,它抛出一个错误说:无法绑定到'data-url',因为它不是已知的本机属性
有人可以帮忙吗?谢谢.
我收到了来自 splunk 的日志,我想获取字符串中间的特定数据并将其用于仪表板。例如:
msg="somestring1 somestring2 500 somestring3 ..."
我如何获得值 500?
抱歉,我不是 splunk 方面的专家。提前致谢