How to get partial text of an element using Selenium2019 Community Moderator Electionxpath exclude certain child element with classDoes a finally block always get executed in Java?How do I read / convert an InputStream into a String in Java?How do I generate random integers within a specific range in Java?How to get an enum value from a string value in Java?How to replace/remove comma from a tezt using Selenium+java?How to calculate specific values - EclipseXPATH and CSS for Selenium Automation - Help RequiredHow to avoid a specific tag while extracting xpathXpath to select text from a child node and current node at onceHow to get parent element text and remove child element text selenium c#?
What does "rhumatis" mean?
Why would /etc/passwd be used every time someone executes `ls -l` command?
The past tense for the quoting particle って
What is Tony Stark injecting into himself in Iron Man 3?
Is "cogitate" an appropriate word for this?
Do natural melee weapons (from racial traits) trigger Improved Divine Smite?
How can I be pwned if I'm not registered on the compromised site?
What is the oldest European royal house?
Practical reasons to have both a large police force and bounty hunting network?
Paper published similar to PhD thesis
Does the US political system, in principle, allow for a no-party system?
I've given my players a lot of magic items. Is it reasonable for me to give them harder encounters?
Affine transformation of circular arc in 3D
Has a sovereign Communist government ever run, and conceded loss, on a fair election?
I can't die. Who am I?
School performs periodic password audits. Is my password compromised?
Why do phishing e-mails use faked e-mail addresses instead of the real one?
Sundering Titan and basic normal lands and snow lands
In the world of The Matrix, what is "popping"?
How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?
Can a space-faring robot still function over a billion years?
When to use the term transposed instead of modulation?
Too soon for a plot twist?
Why would the IRS ask for birth certificates or even audit a small tax return?
How to get partial text of an element using Selenium
2019 Community Moderator Electionxpath exclude certain child element with classDoes a finally block always get executed in Java?How do I read / convert an InputStream into a String in Java?How do I generate random integers within a specific range in Java?How to get an enum value from a string value in Java?How to replace/remove comma from a tezt using Selenium+java?How to calculate specific values - EclipseXPATH and CSS for Selenium Automation - Help RequiredHow to avoid a specific tag while extracting xpathXpath to select text from a child node and current node at onceHow to get parent element text and remove child element text selenium c#?
I have this HTML:
<div id="msg">
<b>text1</b>
<br>
text2 <b>text3</b> text4
<ul class="list">
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
text5
</div>
I want to extract from div[@id = 'msg']
the text before ul
, using xpath.
Like driver.findElement(By.xpath("xpath")).getText()
-> text1 text2 text3 text4
It is possible or I should user another logic?
java selenium selenium-webdriver xpath xpath-1.0
add a comment |
I have this HTML:
<div id="msg">
<b>text1</b>
<br>
text2 <b>text3</b> text4
<ul class="list">
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
text5
</div>
I want to extract from div[@id = 'msg']
the text before ul
, using xpath.
Like driver.findElement(By.xpath("xpath")).getText()
-> text1 text2 text3 text4
It is possible or I should user another logic?
java selenium selenium-webdriver xpath xpath-1.0
1
Your best bet is to get the.innerHTML
from#msg
, split it by theUL
tag, and then strip out the HTML tags.
– JeffC
yesterday
@JeffC how I use.innerHTML
? Can you give me a short example?
– KunLun
yesterday
2
driver.findElement(By.id("msg")).getAttribute("innerHTML");
– JeffC
yesterday
add a comment |
I have this HTML:
<div id="msg">
<b>text1</b>
<br>
text2 <b>text3</b> text4
<ul class="list">
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
text5
</div>
I want to extract from div[@id = 'msg']
the text before ul
, using xpath.
Like driver.findElement(By.xpath("xpath")).getText()
-> text1 text2 text3 text4
It is possible or I should user another logic?
java selenium selenium-webdriver xpath xpath-1.0
I have this HTML:
<div id="msg">
<b>text1</b>
<br>
text2 <b>text3</b> text4
<ul class="list">
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
text5
</div>
I want to extract from div[@id = 'msg']
the text before ul
, using xpath.
Like driver.findElement(By.xpath("xpath")).getText()
-> text1 text2 text3 text4
It is possible or I should user another logic?
java selenium selenium-webdriver xpath xpath-1.0
java selenium selenium-webdriver xpath xpath-1.0
edited yesterday
DebanjanB
43.7k104386
43.7k104386
asked yesterday
KunLunKunLun
7421219
7421219
1
Your best bet is to get the.innerHTML
from#msg
, split it by theUL
tag, and then strip out the HTML tags.
– JeffC
yesterday
@JeffC how I use.innerHTML
? Can you give me a short example?
– KunLun
yesterday
2
driver.findElement(By.id("msg")).getAttribute("innerHTML");
– JeffC
yesterday
add a comment |
1
Your best bet is to get the.innerHTML
from#msg
, split it by theUL
tag, and then strip out the HTML tags.
– JeffC
yesterday
@JeffC how I use.innerHTML
? Can you give me a short example?
– KunLun
yesterday
2
driver.findElement(By.id("msg")).getAttribute("innerHTML");
– JeffC
yesterday
1
1
Your best bet is to get the
.innerHTML
from #msg
, split it by the UL
tag, and then strip out the HTML tags.– JeffC
yesterday
Your best bet is to get the
.innerHTML
from #msg
, split it by the UL
tag, and then strip out the HTML tags.– JeffC
yesterday
@JeffC how I use
.innerHTML
? Can you give me a short example?– KunLun
yesterday
@JeffC how I use
.innerHTML
? Can you give me a short example?– KunLun
yesterday
2
2
driver.findElement(By.id("msg")).getAttribute("innerHTML");
– JeffC
yesterday
driver.findElement(By.id("msg")).getAttribute("innerHTML");
– JeffC
yesterday
add a comment |
2 Answers
2
active
oldest
votes
As per @kjhughes in this discussion, XPath is for selection, not manipulation. You can select nodes as they exist in an XML document, but you cannot transform those nodes.
In your case, if your XML document includes this node:
<div id="msg">
<b>text1</b>
<br>
text2 <b>text3</b> text4
<ul class="list">
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
text5
</div>
You can select the <div
> node through //div[@id='msg']
, but the selected node will appear as it appears in the source XML, that is, with the child with class as list
within the <ul>
node.
If you want to manipulate or transform a node selected via XPath (to exclude its children elements) you'll have to use the hosting language (XSLT, JavaScript, Python, Java, C#, etc) to manipulate the selection.
Solution
To extract the texts individually you can use the following solution:
WebElement myElement = driver.findElement(By.xpath("//div[@id='msg']"));
String text1 = myElement.findElement(By.xpath("./b")).getAttribute("innerHTML");
String text2 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[3].textContent;', myElement).toString();
String text3 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[4].textContent;', myElement).toString();
String text4 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[5].textContent;', myElement).toString();
String text5 = ((JavascriptExecutor)driver).executeScript('return arguments[0].lastChild.textContent;', myElement).toString();
I want to use xpath. Your suggest get entire div because@ul
mean attributeul
ofdiv
.
– KunLun
yesterday
Same. Your xpath now looking for div to not haveclass='list'
:) Answer of Waqar Nadir is the nearest one, but still not the result I want.
– KunLun
yesterday
This doesn't work. This gets theDIV
that has an idmsg
that doesn't have the class 'list'... thats<div id="msg">
... and it gets the entirety of the text inside that tag which is everything.
– JeffC
yesterday
1
I use xpath and get all div :text1 text2 text3 text4 ... ... ... text5
and If you try to understand logically//div[@id='msg' and not(@class='list')]
-> getdiv
withid = msg
andclass != list
– KunLun
yesterday
@KunLun Checkout my updated answer and let me know the status.
– DebanjanB
yesterday
add a comment |
Just want to share another idea.
You can get the OuterHTML and then strip it till "ul" tag and then remove the html tags from the output. Now you can change the string as per your need.
I am almost able to get the text you are looking for, using javascript. Pasted it below for your reference, you can do the same in Java.
oHTML = document.querySelector("div#msg").outerHTML
oHTML.substring(0,oHTML.search('<ul')).replace(/<.*>/,'').replace(/</?[^>]+(>|$)/g, "").replace(/n/g, " ").trim()
you can run this in the browser console to see the output. Below is the javascript output.
text1 text2 text3 text4
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55023306%2fhow-to-get-partial-text-of-an-element-using-selenium%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
As per @kjhughes in this discussion, XPath is for selection, not manipulation. You can select nodes as they exist in an XML document, but you cannot transform those nodes.
In your case, if your XML document includes this node:
<div id="msg">
<b>text1</b>
<br>
text2 <b>text3</b> text4
<ul class="list">
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
text5
</div>
You can select the <div
> node through //div[@id='msg']
, but the selected node will appear as it appears in the source XML, that is, with the child with class as list
within the <ul>
node.
If you want to manipulate or transform a node selected via XPath (to exclude its children elements) you'll have to use the hosting language (XSLT, JavaScript, Python, Java, C#, etc) to manipulate the selection.
Solution
To extract the texts individually you can use the following solution:
WebElement myElement = driver.findElement(By.xpath("//div[@id='msg']"));
String text1 = myElement.findElement(By.xpath("./b")).getAttribute("innerHTML");
String text2 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[3].textContent;', myElement).toString();
String text3 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[4].textContent;', myElement).toString();
String text4 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[5].textContent;', myElement).toString();
String text5 = ((JavascriptExecutor)driver).executeScript('return arguments[0].lastChild.textContent;', myElement).toString();
I want to use xpath. Your suggest get entire div because@ul
mean attributeul
ofdiv
.
– KunLun
yesterday
Same. Your xpath now looking for div to not haveclass='list'
:) Answer of Waqar Nadir is the nearest one, but still not the result I want.
– KunLun
yesterday
This doesn't work. This gets theDIV
that has an idmsg
that doesn't have the class 'list'... thats<div id="msg">
... and it gets the entirety of the text inside that tag which is everything.
– JeffC
yesterday
1
I use xpath and get all div :text1 text2 text3 text4 ... ... ... text5
and If you try to understand logically//div[@id='msg' and not(@class='list')]
-> getdiv
withid = msg
andclass != list
– KunLun
yesterday
@KunLun Checkout my updated answer and let me know the status.
– DebanjanB
yesterday
add a comment |
As per @kjhughes in this discussion, XPath is for selection, not manipulation. You can select nodes as they exist in an XML document, but you cannot transform those nodes.
In your case, if your XML document includes this node:
<div id="msg">
<b>text1</b>
<br>
text2 <b>text3</b> text4
<ul class="list">
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
text5
</div>
You can select the <div
> node through //div[@id='msg']
, but the selected node will appear as it appears in the source XML, that is, with the child with class as list
within the <ul>
node.
If you want to manipulate or transform a node selected via XPath (to exclude its children elements) you'll have to use the hosting language (XSLT, JavaScript, Python, Java, C#, etc) to manipulate the selection.
Solution
To extract the texts individually you can use the following solution:
WebElement myElement = driver.findElement(By.xpath("//div[@id='msg']"));
String text1 = myElement.findElement(By.xpath("./b")).getAttribute("innerHTML");
String text2 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[3].textContent;', myElement).toString();
String text3 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[4].textContent;', myElement).toString();
String text4 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[5].textContent;', myElement).toString();
String text5 = ((JavascriptExecutor)driver).executeScript('return arguments[0].lastChild.textContent;', myElement).toString();
I want to use xpath. Your suggest get entire div because@ul
mean attributeul
ofdiv
.
– KunLun
yesterday
Same. Your xpath now looking for div to not haveclass='list'
:) Answer of Waqar Nadir is the nearest one, but still not the result I want.
– KunLun
yesterday
This doesn't work. This gets theDIV
that has an idmsg
that doesn't have the class 'list'... thats<div id="msg">
... and it gets the entirety of the text inside that tag which is everything.
– JeffC
yesterday
1
I use xpath and get all div :text1 text2 text3 text4 ... ... ... text5
and If you try to understand logically//div[@id='msg' and not(@class='list')]
-> getdiv
withid = msg
andclass != list
– KunLun
yesterday
@KunLun Checkout my updated answer and let me know the status.
– DebanjanB
yesterday
add a comment |
As per @kjhughes in this discussion, XPath is for selection, not manipulation. You can select nodes as they exist in an XML document, but you cannot transform those nodes.
In your case, if your XML document includes this node:
<div id="msg">
<b>text1</b>
<br>
text2 <b>text3</b> text4
<ul class="list">
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
text5
</div>
You can select the <div
> node through //div[@id='msg']
, but the selected node will appear as it appears in the source XML, that is, with the child with class as list
within the <ul>
node.
If you want to manipulate or transform a node selected via XPath (to exclude its children elements) you'll have to use the hosting language (XSLT, JavaScript, Python, Java, C#, etc) to manipulate the selection.
Solution
To extract the texts individually you can use the following solution:
WebElement myElement = driver.findElement(By.xpath("//div[@id='msg']"));
String text1 = myElement.findElement(By.xpath("./b")).getAttribute("innerHTML");
String text2 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[3].textContent;', myElement).toString();
String text3 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[4].textContent;', myElement).toString();
String text4 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[5].textContent;', myElement).toString();
String text5 = ((JavascriptExecutor)driver).executeScript('return arguments[0].lastChild.textContent;', myElement).toString();
As per @kjhughes in this discussion, XPath is for selection, not manipulation. You can select nodes as they exist in an XML document, but you cannot transform those nodes.
In your case, if your XML document includes this node:
<div id="msg">
<b>text1</b>
<br>
text2 <b>text3</b> text4
<ul class="list">
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
text5
</div>
You can select the <div
> node through //div[@id='msg']
, but the selected node will appear as it appears in the source XML, that is, with the child with class as list
within the <ul>
node.
If you want to manipulate or transform a node selected via XPath (to exclude its children elements) you'll have to use the hosting language (XSLT, JavaScript, Python, Java, C#, etc) to manipulate the selection.
Solution
To extract the texts individually you can use the following solution:
WebElement myElement = driver.findElement(By.xpath("//div[@id='msg']"));
String text1 = myElement.findElement(By.xpath("./b")).getAttribute("innerHTML");
String text2 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[3].textContent;', myElement).toString();
String text3 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[4].textContent;', myElement).toString();
String text4 = ((JavascriptExecutor)driver).executeScript('return arguments[0].childNodes[5].textContent;', myElement).toString();
String text5 = ((JavascriptExecutor)driver).executeScript('return arguments[0].lastChild.textContent;', myElement).toString();
edited yesterday
answered yesterday
DebanjanBDebanjanB
43.7k104386
43.7k104386
I want to use xpath. Your suggest get entire div because@ul
mean attributeul
ofdiv
.
– KunLun
yesterday
Same. Your xpath now looking for div to not haveclass='list'
:) Answer of Waqar Nadir is the nearest one, but still not the result I want.
– KunLun
yesterday
This doesn't work. This gets theDIV
that has an idmsg
that doesn't have the class 'list'... thats<div id="msg">
... and it gets the entirety of the text inside that tag which is everything.
– JeffC
yesterday
1
I use xpath and get all div :text1 text2 text3 text4 ... ... ... text5
and If you try to understand logically//div[@id='msg' and not(@class='list')]
-> getdiv
withid = msg
andclass != list
– KunLun
yesterday
@KunLun Checkout my updated answer and let me know the status.
– DebanjanB
yesterday
add a comment |
I want to use xpath. Your suggest get entire div because@ul
mean attributeul
ofdiv
.
– KunLun
yesterday
Same. Your xpath now looking for div to not haveclass='list'
:) Answer of Waqar Nadir is the nearest one, but still not the result I want.
– KunLun
yesterday
This doesn't work. This gets theDIV
that has an idmsg
that doesn't have the class 'list'... thats<div id="msg">
... and it gets the entirety of the text inside that tag which is everything.
– JeffC
yesterday
1
I use xpath and get all div :text1 text2 text3 text4 ... ... ... text5
and If you try to understand logically//div[@id='msg' and not(@class='list')]
-> getdiv
withid = msg
andclass != list
– KunLun
yesterday
@KunLun Checkout my updated answer and let me know the status.
– DebanjanB
yesterday
I want to use xpath. Your suggest get entire div because
@ul
mean attribute ul
of div
.– KunLun
yesterday
I want to use xpath. Your suggest get entire div because
@ul
mean attribute ul
of div
.– KunLun
yesterday
Same. Your xpath now looking for div to not have
class='list'
:) Answer of Waqar Nadir is the nearest one, but still not the result I want.– KunLun
yesterday
Same. Your xpath now looking for div to not have
class='list'
:) Answer of Waqar Nadir is the nearest one, but still not the result I want.– KunLun
yesterday
This doesn't work. This gets the
DIV
that has an id msg
that doesn't have the class 'list'... thats <div id="msg">
... and it gets the entirety of the text inside that tag which is everything.– JeffC
yesterday
This doesn't work. This gets the
DIV
that has an id msg
that doesn't have the class 'list'... thats <div id="msg">
... and it gets the entirety of the text inside that tag which is everything.– JeffC
yesterday
1
1
I use xpath and get all div :
text1 text2 text3 text4 ... ... ... text5
and If you try to understand logically //div[@id='msg' and not(@class='list')]
-> get div
with id = msg
and class != list
– KunLun
yesterday
I use xpath and get all div :
text1 text2 text3 text4 ... ... ... text5
and If you try to understand logically //div[@id='msg' and not(@class='list')]
-> get div
with id = msg
and class != list
– KunLun
yesterday
@KunLun Checkout my updated answer and let me know the status.
– DebanjanB
yesterday
@KunLun Checkout my updated answer and let me know the status.
– DebanjanB
yesterday
add a comment |
Just want to share another idea.
You can get the OuterHTML and then strip it till "ul" tag and then remove the html tags from the output. Now you can change the string as per your need.
I am almost able to get the text you are looking for, using javascript. Pasted it below for your reference, you can do the same in Java.
oHTML = document.querySelector("div#msg").outerHTML
oHTML.substring(0,oHTML.search('<ul')).replace(/<.*>/,'').replace(/</?[^>]+(>|$)/g, "").replace(/n/g, " ").trim()
you can run this in the browser console to see the output. Below is the javascript output.
text1 text2 text3 text4
add a comment |
Just want to share another idea.
You can get the OuterHTML and then strip it till "ul" tag and then remove the html tags from the output. Now you can change the string as per your need.
I am almost able to get the text you are looking for, using javascript. Pasted it below for your reference, you can do the same in Java.
oHTML = document.querySelector("div#msg").outerHTML
oHTML.substring(0,oHTML.search('<ul')).replace(/<.*>/,'').replace(/</?[^>]+(>|$)/g, "").replace(/n/g, " ").trim()
you can run this in the browser console to see the output. Below is the javascript output.
text1 text2 text3 text4
add a comment |
Just want to share another idea.
You can get the OuterHTML and then strip it till "ul" tag and then remove the html tags from the output. Now you can change the string as per your need.
I am almost able to get the text you are looking for, using javascript. Pasted it below for your reference, you can do the same in Java.
oHTML = document.querySelector("div#msg").outerHTML
oHTML.substring(0,oHTML.search('<ul')).replace(/<.*>/,'').replace(/</?[^>]+(>|$)/g, "").replace(/n/g, " ").trim()
you can run this in the browser console to see the output. Below is the javascript output.
text1 text2 text3 text4
Just want to share another idea.
You can get the OuterHTML and then strip it till "ul" tag and then remove the html tags from the output. Now you can change the string as per your need.
I am almost able to get the text you are looking for, using javascript. Pasted it below for your reference, you can do the same in Java.
oHTML = document.querySelector("div#msg").outerHTML
oHTML.substring(0,oHTML.search('<ul')).replace(/<.*>/,'').replace(/</?[^>]+(>|$)/g, "").replace(/n/g, " ").trim()
you can run this in the browser console to see the output. Below is the javascript output.
text1 text2 text3 text4
answered 51 mins ago
supputurisupputuri
754
754
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55023306%2fhow-to-get-partial-text-of-an-element-using-selenium%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Your best bet is to get the
.innerHTML
from#msg
, split it by theUL
tag, and then strip out the HTML tags.– JeffC
yesterday
@JeffC how I use
.innerHTML
? Can you give me a short example?– KunLun
yesterday
2
driver.findElement(By.id("msg")).getAttribute("innerHTML");
– JeffC
yesterday