Javascript exception in Selenium - Java - org.openqa.selenium.JavascriptException: [object Object]

60 Views Asked by At

The line in the code is:

a = driver.findElement(RelativeLocator.with(By.tagName("style")).toRightOf(By.tagName("colspan"))).getText();

There is a very long essay by way of error in the Console section, including am MIT license disclaimer (?)... I cannot make head or tail of it. I struggled making this line of code, I'm sure there must be some error in it. The goal is to get a net figure (bottom right) from an online table, but it's behind a login which I can't share.

When you hover over the html, there is a structure like

<head><body><table><tbody><tr><td><b>

The exact cell I need is on the <td> part, but the data in it is in the <b> part. There is no tag or anything in the <b> part. There is an iframe as well, but I verified that i'm on the correct one, as I do get the correct result using xpath. But I need a relative locator, because there are multiple pages with different tables, and they are dynamically generated and vary in size from day to day as well. I hope this was enough information... if not please ask for whatever else is needed...thank you! Here is a list of all the errors:

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:200)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:133)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:52)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:191)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:196)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:171)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:518)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:463)
at org.openqa.selenium.support.locators.RelativeLocator$RelativeBy.findElements(RelativeLocator.java:194)
at org.openqa.selenium.By.findElement(By.java:122)
at org.openqa.selenium.remote.ElementLocation$ElementFinder$1.findElement(ElementLocation.java:139)
at org.openqa.selenium.remote.ElementLocation.findElement(ElementLocation.java:81)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:355)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:349)
at artifactidshilpipackage.shilpi.main(shilpi.java:82)
0

There are 0 best solutions below