The following JS code provides 'X' as output when it is executed on webpage console.
replies = document.getElementsByClassName("qwe12s");
i=0;
for (reply of replies) {
if (reply.querySelector(".bxj22_aj").innerText.split("@")[1] === "rediffmail.com") {
if (i==1) {
reply.querySelector(".bsjh2_6d").innerText;
break;
}
i++;
}
}
However, I need to run the code through Python Selenium and store 'X' in a list.
I've previously used WebDriver's execute_script() but only for single line JS code.
How do I get output 'X' from the above mentioned JS code in a python list using execute_script() or any other alternative?
P.S.: I've tried solutions provided on - Getting the return value of Javascript code in Selenium but I didn't get output from it. I'm not sure what's going wrong.