You need to use #text
method.
browser.find_element(:css,"#total > tbody > tr > td:nth-child(4) > span").text
attribute
method is used to get the value of attributes of HTML elements. In your case, there is no attribute called 'value'
in span
element, thus the method returns nil
. For more information read the documentation I linked.