问题描述
如何在Webdriver IO中使用参数构建xpath 我必须将xpath作为参数传递,像这样- const xpAthForthePageMenuItem =“(// div [contains(text(),”“” + PagetoNavigateto +“”)])[2]“ 现在,上面的变量是我的实际xpath值,我需要传递给elem const才能编写选择器- const elem = $(xpAthForthePage)-完成此操作的正确方法是什么? 我如何在webdriverIO中实现类似的功能? 请有人帮忙吗?
解决方法
//base class
class A {
// The virtual method
protected virtualStuff1?():void;
public Stuff2(){
//Calling overridden child method by parent if implemented
this.virtualStuff1 && this.virtualStuff1();
alert("Baseclass Stuff2");
}
}
//class B implementing virtual method
class B extends A{
// overriding virtual method
public virtualStuff1()
{
alert("Class B virtualStuff1");
}
}
//Class C not implementing virtual method
class C extends A{
}
var b1 = new B();
var c1= new C();
b1.Stuff2();
b1.virtualStuff1();
c1.Stuff2();