put a string with html/Javascript into selenium webdriver

前端 未结 5 1198
不思量自难忘°
不思量自难忘° 2020-12-03 01:19

I have a html document in memory as a string. It contains a

5条回答
  •  甜味超标
    2020-12-03 02:01

    If you don't want to create a file or load a URL before being able to replace the content of the page, you can always leverage the Data URLs feature, which supports HTML, CSS and JavaScript:

    ChromeDriver driver = new ChromeDriver();
    html_content = """
    
         
         
             
    Hello World =)
    """ driver.get("data:text/html;charset=utf-8," + html_content)

提交回复
热议问题