How to assign webelement to string with javascript Executor

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to assign webelement to string with javascript Executor

sreedevivasudevan91

my id is hidden,how to assign webelement to string with javascript Executor

i have to perform below 2 operation with javascript executor:

String cartCountSearchTab = driver.findElement(By.id(("")).getText().replaceAll(" ", "");
int cartCountTab = Integer.parseInt(cartCountSearchTab);

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/af81c07e-b339-426b-82fc-f0056ea2fe78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

How to assign webelement to string with javascript Executor

Brenda Granados
I'm a little unsure what you mean by the id is hidden. But if you do know it, you can try:
"document.getElementById('yourId')" in the JavaScript executor.execute call. You might try looking for that as a search term on the web, for more examples.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4d1807a1-a4be-490e-ad6d-b6f6771e6b3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.