Compare strings with Selenium Webdriver

53 views
Skip to first unread message

ama...@bufetedemarketing.com

unread,
May 11, 2017, 6:01:34 AM5/11/17
to Selenium Users
Hi everyone!

Now I have the data from Highcharts (at least!!!!), I need to compare with a string given by me to println "CORRECT DATA", or "WRONG DATA".

I've written the following:


But as you can see, the results are not OK. The data that I compare is in the array and this code doesn't work because it shows "WRONG DATA" (is the same of "DATO NO ENCONTRADO", in Spanish)...

What have I done wrong?

Thanks so much!!!

ama...@bufetedemarketing.com

unread,
May 11, 2017, 6:08:36 AM5/11/17
to Selenium Users
I've realized that I put the conditions bad, here the right code:

if (prueba1 == -1) System.out.println(a +" WRONG DATA"); else System.out.println(a +"CORRECT DATA");

Thanks!!

ama...@bufetedemarketing.com

unread,
May 11, 2017, 6:13:10 AM5/11/17
to Selenium Users
Still, with the change of code in the conditionals, It doesn't work correctly and I don't know why...

ama...@bufetedemarketing.com

unread,
May 11, 2017, 7:08:35 AM5/11/17
to Selenium Users
I've solved. with this code:

                        int prueba1 = row.getText().indexOf(a);
               int prueba2 = row.getText().indexOf(b);
               int prueba3 = row.getText().indexOf(c);

Solved!

El jueves, 11 de mayo de 2017, 12:01:34 (UTC+2), ama...@bufetedemarketing.com escribió:
Reply all
Reply to author
Forward
0 new messages