我已经研究并尝试了几种不同的方法来识别断言测试的元素。 Xpath不起作用,ng-model不起作用。有什么想法吗?
<input type="text" ng-class="{'ng-dirty': !merchant.name}" ng-
model="merchant.name" required="" class="ng-pristine ng-valid ng-not-empty
ng-valid-required ng-touched" style="">
我到目前为止的代码:
@Test
public static void merchant_name() {
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
WebElement merchant_name = driver.findElement(
By.xpath("input[@class='ng-pristine ng-valid ng-not-empty ng-valid-required ng-touched']")
);
Assert.assertEquals(merchant_name.getAttribute("value"), "Regression Testing");
}
答案 0 :(得分:0)
您可以考虑使用int is 4 bytes.
short is 2 bytes.
long is 8 bytes.
long long is 8 bytes.
Maximum values:
int: 2147483647
short: 32767
long: 9223372036854775807
llong: 9223372036854775807
Minimum int value = -2147483648
Maximum int value = 2147483647
Bits per byte = 8
属性使用以下xpath
:
class
另一种策略可能是同时使用//input[@class='ng-pristine ng-valid ng-not-empty ng-valid-required ng-touched']
和class
属性:
type
答案 1 :(得分:0)
这就是诀窍。
@Test
public static void merchant_name() {
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
WebElement merchant_name =
driver.findElement(By.xpath("html/body/div[1]/div/ng-
view/div/div/div[2]/div/div/ng-form/div[3]/div/input"));
Assert.assertEquals(merchant_name.getAttribute("value"), "Regression
Testing");
}