Get HTML Source of WebElement in Selenium WebDriver using Python

后端 未结 14 1750
误落风尘
误落风尘 2020-11-22 13:45

I\'m using the Python bindings to run Selenium WebDriver:

from selenium import webdriver
wd = webdriver.Firefox()

I know I can grab a webel

相关标签:
14条回答
  • 2020-11-22 14:27

    Using the attribute method is, in fact, easier and more straight forward.

    Using Ruby with the Selenium and PageObject gems, to get the class associated with a certain element, the line would be element.attribute(Class).

    The same concept applies if you wanted to get other attributes tied to the element. For example, if I wanted the String of an element, element.attribute(String).

    0 讨论(0)
  • 2020-11-22 14:29

    If you are interested in a solution for Remote Control in Python, here is how to get innerHTML:

    innerHTML = sel.get_eval("window.document.getElementById('prodid').innerHTML")
    
    0 讨论(0)
提交回复
热议问题