自动化测试BUG

元素定位

1.定位首选id,id属性唯一,定位最准确,即driver.findElement(By.id("id"));弊端:大部分元素没有id属性,因此很少用,但只要有,肯定首选。
2.次选xpath,定位准确度仅次于id,例:driver.findElement(By.xpath("xpath"));弊端:最近才发现的,当一个页面含drawer时,可能出现定位出错,
org.openqa.selenium.ElementClickInterceptedException: Element

is not clickable at point (870,661) because another element

results matching ""

    No results matching ""