0

I have this simple html code:

<html>
    <head></head>
  <body>
    <p>
      <span class="bold-title">This is</span>
      " a test"
    </p>
  </body>
  </html>

i want to get " a test" by it's xpath using webbot

the code that seems to "work" is:

from webbot import Browser
driver = Browser(showWindow=True)
driver.go_to('file:///C:/Users/myself/Desktop/test.html')
outp = driver.execute_script("return document.evaluate('/html/body/p/text()', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;")
print(outp)

the xpath "/html/body/p/text()" should theoretically return " a test", but webbot decided to print "[None, None, None, None, None, None, None]", what is going on?

Pigi
  • 1
  • 4

0 Answers0