Skip to content Skip to sidebar Skip to footer

Selenium Get String Value From Div OnClick Element

Im trying to get the email address from the following code but im not sure how to do it. Any help would be appreciated
)).getAttribute("onclick"); // split the onclick value on ',' String[] allTextArray = onClickValue.split(","); // iterate through the array and is @ is contained with the text, print text for (String text : allTextArray) { if (text.contains("@")) { System.out.println(text); return; } }

Note: The XPath of the div might be different. I have written it based on what little HTML you posted.


Post a Comment for "Selenium Get String Value From Div OnClick Element"