selenium in python : Return the special value [duplicate]
This question already has an answer here:
How to get text with selenium web driver in python
5 answers
I want to get the number 31 in the shaded blue block here. So, I typed code.
val=driver.find_element_by_xpath("/html/body/div/table/tbody/tr[8]/td[2]")
print(val)
(The xpath of the box marked 31 is /html/body/div/table/tbody/tr[8]/td[2]
.)
But, I get
<selenium.webdriver.remote.webelement.WebElement (session="3e74d73f7dc4cd9a52b5430b7fa69678", element="0.771890890368685-1")>
What should I do to get the number 31? ^^
python selenium
marked as duplicate by Andersson
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 23 '18 at 17:09
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How to get text with selenium web driver in python
5 answers
I want to get the number 31 in the shaded blue block here. So, I typed code.
val=driver.find_element_by_xpath("/html/body/div/table/tbody/tr[8]/td[2]")
print(val)
(The xpath of the box marked 31 is /html/body/div/table/tbody/tr[8]/td[2]
.)
But, I get
<selenium.webdriver.remote.webelement.WebElement (session="3e74d73f7dc4cd9a52b5430b7fa69678", element="0.771890890368685-1")>
What should I do to get the number 31? ^^
python selenium
marked as duplicate by Andersson
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 23 '18 at 17:09
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Could you supply raw version of html file for testing?
– Filip Młynarski
Nov 23 '18 at 16:55
This page is only visible when I log in with my personal ID. I am curious to know the value in the box. when I know the xpath of the box.
– JAE_RYONG
Nov 23 '18 at 16:59
add a comment |
This question already has an answer here:
How to get text with selenium web driver in python
5 answers
I want to get the number 31 in the shaded blue block here. So, I typed code.
val=driver.find_element_by_xpath("/html/body/div/table/tbody/tr[8]/td[2]")
print(val)
(The xpath of the box marked 31 is /html/body/div/table/tbody/tr[8]/td[2]
.)
But, I get
<selenium.webdriver.remote.webelement.WebElement (session="3e74d73f7dc4cd9a52b5430b7fa69678", element="0.771890890368685-1")>
What should I do to get the number 31? ^^
python selenium
This question already has an answer here:
How to get text with selenium web driver in python
5 answers
I want to get the number 31 in the shaded blue block here. So, I typed code.
val=driver.find_element_by_xpath("/html/body/div/table/tbody/tr[8]/td[2]")
print(val)
(The xpath of the box marked 31 is /html/body/div/table/tbody/tr[8]/td[2]
.)
But, I get
<selenium.webdriver.remote.webelement.WebElement (session="3e74d73f7dc4cd9a52b5430b7fa69678", element="0.771890890368685-1")>
What should I do to get the number 31? ^^
This question already has an answer here:
How to get text with selenium web driver in python
5 answers
python selenium
python selenium
edited Nov 23 '18 at 18:26
Brian
4,61672740
4,61672740
asked Nov 23 '18 at 16:51
JAE_RYONGJAE_RYONG
264
264
marked as duplicate by Andersson
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 23 '18 at 17:09
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Andersson
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 23 '18 at 17:09
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Could you supply raw version of html file for testing?
– Filip Młynarski
Nov 23 '18 at 16:55
This page is only visible when I log in with my personal ID. I am curious to know the value in the box. when I know the xpath of the box.
– JAE_RYONG
Nov 23 '18 at 16:59
add a comment |
Could you supply raw version of html file for testing?
– Filip Młynarski
Nov 23 '18 at 16:55
This page is only visible when I log in with my personal ID. I am curious to know the value in the box. when I know the xpath of the box.
– JAE_RYONG
Nov 23 '18 at 16:59
Could you supply raw version of html file for testing?
– Filip Młynarski
Nov 23 '18 at 16:55
Could you supply raw version of html file for testing?
– Filip Młynarski
Nov 23 '18 at 16:55
This page is only visible when I log in with my personal ID. I am curious to know the value in the box. when I know the xpath of the box.
– JAE_RYONG
Nov 23 '18 at 16:59
This page is only visible when I log in with my personal ID. I am curious to know the value in the box. when I know the xpath of the box.
– JAE_RYONG
Nov 23 '18 at 16:59
add a comment |
1 Answer
1
active
oldest
votes
You're printing the entire element. An element is a complex object with a lot of attributes and such. But you really only want the text of the element.
So use:
print(val.text)
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You're printing the entire element. An element is a complex object with a lot of attributes and such. But you really only want the text of the element.
So use:
print(val.text)
add a comment |
You're printing the entire element. An element is a complex object with a lot of attributes and such. But you really only want the text of the element.
So use:
print(val.text)
add a comment |
You're printing the entire element. An element is a complex object with a lot of attributes and such. But you really only want the text of the element.
So use:
print(val.text)
You're printing the entire element. An element is a complex object with a lot of attributes and such. But you really only want the text of the element.
So use:
print(val.text)
edited Nov 23 '18 at 21:49
Corey Goldberg
37.3k22108123
37.3k22108123
answered Nov 23 '18 at 17:10
John GordonJohn Gordon
9,76151729
9,76151729
add a comment |
add a comment |
Could you supply raw version of html file for testing?
– Filip Młynarski
Nov 23 '18 at 16:55
This page is only visible when I log in with my personal ID. I am curious to know the value in the box. when I know the xpath of the box.
– JAE_RYONG
Nov 23 '18 at 16:59