Why my test is throwing Exception-Unable to locate element in webdriver?

前端 未结 5 1039
鱼传尺愫
鱼传尺愫 2021-01-24 06:41
package testproject;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.*;
          


        
5条回答
  •  旧时难觅i
    2021-01-24 07:44

    Remove the dot at the beginning of your xpath expression. That way you have an xpath expression thaty could match everything. With the dot at the beginning you might retrict yourself depending on if the current node is the root node or not. Ther eis no way to know it. Just the fact the dot can only give you trouble. Unfortunately you cannot always trust what tools like firebug give you (it is still true in 99% of the case).

    Of course, ensure that the elemetns you are targeting are already on the screen as suggested by the previous answer.

提交回复
热议问题