protractor icon indicating copy to clipboard operation
protractor copied to clipboard

string manipulation via browser.executeScript fails

Open Basman01 opened this issue 12 years ago • 1 comments

hi.

In my test i want to do a check in which it needs to make an url change .for this i need the data from a string ,Only one problem the string ends with a space.

I tried multiple things like

Number = document.getElementsByClassName("grid_3 overflow-hidden ng-binding")[40].innerText.slice(0,14);

and :

Number.replace(/\s/g, "");

then i tried to run this code in just an javascript file and it worked

Is protractor maybe blocking string manipulation or do i need to add something so that it workes in protractor?

Edit : this code is activated by browser.executeScript()

Basman01 avatar Jan 30 '14 13:01 Basman01

Fixed

.slice(0,14); needed to be .slice(0,13); (i started counting at 1 instead of 0)

it works now ,weird thing is i still dont know why it then worked in normal javascript file but thats ok

sorry for this issue i made a dumb mistake

Basman01 avatar Jan 30 '14 13:01 Basman01