-2

I could not use the default By commands in selenium. Below is my script

driver.findElement(By.xpath("//*[@id='lotstatus_q']/div/table/tbody/tr"));

my script is failing and the result is this:By is not a function

is there any other items that I need to install?

All other By commands are not functioning.

John Saunders
  • 160,644
  • 26
  • 247
  • 397

2 Answers2

1

I think you made a mistake, you cannot directly access to Selenium API from Nightwatch.js !

Nightwatch is just an override of the WebDriver Wire Protocole (exposed by Selenium as REST API) https://code.google.com/p/selenium/wiki/JsonWireProtocol

But you can use XPath selectors with Nightwatch:

client.useXpath().waitForElementVisible("//*[@id='lotstatus_q']/div/table/tbody/tr")

Read the doc about XPath: http://nightwatchjs.org/guide#using-xpath-selectors

Nicolas Pennec
  • 7,533
  • 29
  • 43
0

You cannot apply the regular Java patterns with NightWatchJS and also NightWatch Apis does not work that way...

Please see the API docs on how you can use http://nightwatchjs.org/api#commands

I think you are trying to do

browser.elements("css locator" , "value of your css", function (result){
     // here result is the return from calling selenium wire protocol /elements
     // Using the identifier of your CSS locators
}) 
mekdev
  • 468
  • 6
  • 14