selenium in python : Return the special value [duplicate]












0
















This question already has an answer here:




  • How to get text with selenium web driver in python

    5 answers




enter image description here



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? ^^










share|improve this question















marked as duplicate by Andersson python
Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

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
















0
















This question already has an answer here:




  • How to get text with selenium web driver in python

    5 answers




enter image description here



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? ^^










share|improve this question















marked as duplicate by Andersson python
Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

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














0












0








0









This question already has an answer here:




  • How to get text with selenium web driver in python

    5 answers




enter image description here



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? ^^










share|improve this question

















This question already has an answer here:




  • How to get text with selenium web driver in python

    5 answers




enter image description here



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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 python
Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

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 python
Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

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



















  • 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












1 Answer
1






active

oldest

votes


















0














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)






share|improve this answer
































    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    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)






    share|improve this answer






























      0














      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)






      share|improve this answer




























        0












        0








        0







        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)






        share|improve this answer















        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)







        share|improve this answer














        share|improve this answer



        share|improve this answer








        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















            Popular posts from this blog

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            Refactoring coordinates for Minecraft Pi buildings written in Python