TestProject Forum
Powered by leading experts in the test automation community

I am getting below error while trying to automate sample Qlikview web report tho

I am getting below error while trying to automate sample Qlikview web report though Selenium

Xpath returned by FirePath:

  .//*[@id='58']/div[2]/div/div[1]/div[4]/div[1]

Exception:

**Exception**: Exception in thread "main" org.openqa.selenium.InvalidSelectorException: The given selector//[@id='58']/div[2]/div/div[1]/div[4]/div[1] is either invalid or does not result in a WebElement. The following error occurred: InvalidSelectorError: Unable to locate an element with the xpath expression //[@id='58']/div[2]/div/div[1]/div[4]/div[1] because of the following error:**SyntaxError: The expression is not a legal expression.** Command duration or timeout: 78 milliseconds For documentation on this error, please visit: http://seleniumhq.org /exceptions/invalid_selector_exception.html Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35'

I tried running by removing ‘.’ from xpath but still the same error is occuring.

Code Sample:

// Navigate to Quarter 4 Results

driver.findElement(By.xpath("//[@id='58']/div[2]/div/div[1]/div[4]/div[1]")).click(); }

Your XPath is indeed wrong, it should have a wildcard before the square bracket as FirePath returns:

.//*
Your doesn’t:

//[@id='58']