Note that there are some explanatory texts on larger screens.

plurals
  1. PO"verifyTextPresent" is giving me a wrong result when I run the code in Java
    text
    copied!<p>I used Selenium IDE to create a recorded test and one of the commands used was verifyTextPresent. The IDE says there is an error if the text is changed (which is what is expected).</p> <p>I put the recorded test into Eclipse and ran it, the results says it passed. </p> <p>Now I have put in different values and never changed the values in my code, but eclipse says it runs fine with no errors. But when I run it in the IDE, it says there are errors and it highlights where the error is.</p> <p>How come it does not fail on Eclipse when different values are entered for the verifyTextPresent?</p> <p>Here is the code I use;</p> <pre><code>public class MarvinDataTest extends SeleneseTestBase { private Selenium selenium; private String success = "success"; @Before public void setUp() throws Exception { selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://localhost:8000/"); selenium.start(); } @Test public void testMarvinDataTest() throws Exception { selenium.open("/eem/api/v1/metrics/displacement/286"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); selenium.open("/eem/api/v1/metrics/displacement/287"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); selenium.open("/eem/api/v1/metrics/displacement/288"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); ***verifyTrue(selenium.isTextPresent("\"displacement\": 20,"));*** selenium.open("/eem/api/v1/metrics/humidity/286"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); selenium.open("/eem/api/v1/metrics/humidity/287"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); selenium.open("/eem/api/v1/metrics/humidity/288"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); selenium.open("/eem/api/v1/metrics/load/286"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); selenium.open("/eem/api/v1/metrics/load/287"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); selenium.open("/eem/api/v1/metrics/load/288"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); ***verifyTrue(selenium.isTextPresent("\"load\": 4,"));*** selenium.open("/eem/api/v1/metrics/pressure/286"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); selenium.open("/eem/api/v1/metrics/pressure/287"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); selenium.open("/eem/api/v1/metrics/pressure/288"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); selenium.open("/eem/api/v1/metrics/temperature/286"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); selenium.open("/eem/api/v1/metrics/temperature/287"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); selenium.open("/eem/api/v1/metrics/temperature/288"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); verifyTrue(selenium.isTextPresent("\"temperature\": 17")); selenium.open("/eem/api/v1/metrics/vibration/286"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); selenium.open("/eem/api/v1/metrics/vibration/287"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); selenium.open("/eem/api/v1/metrics/vibration/288"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); ***verifyTrue(selenium.isTextPresent("\"vibration\": 4"));*** selenium.open("/eem/api/v1/metrics"); assertEquals("", selenium.getTitle()); verifyTrue(selenium.isTextPresent("success")); verifyTrue(selenium.isTextPresent("mm")); verifyTrue(selenium.isTextPresent("%")); verifyTrue(selenium.isTextPresent("kg")); verifyTrue(selenium.isTextPresent("N/m")); verifyTrue(selenium.isTextPresent("C")); verifyTrue(selenium.isTextPresent("G")); selenium.addScript("", ""); } @After public void tearDown() throws Exception { selenium.stop(); } } </code></pre> <p>The lines with the asterisks have the wrong data in it and should show up false. It shows an error when using the IDE but when using Eclipse it says it has passed with no errors.</p> <p>Can somebody please explain this and help me with finding a solution?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload