首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Selenium Python修改站点的InnerHTML

使用Selenium Python修改站点的InnerHTML
EN

Stack Overflow用户
提问于 2020-09-24 19:51:52
回答 1查看 115关注 0票数 0

我想修改diigo.com站点的innerHTML,我有以下diigo.com代码

代码语言:javascript
复制
HTML = """
4 Methods to Make Bitcoin for Totally free?

<img src=" https://topcryptofaucets.com/img/logo.png" alt="" width="450" height="250" />

know more|for more information}.</p>

<p>1: Try Taps</p>

<p>Faucets are the simplest way associated with earning Bitcoin on the internet. Since it demands no deep understanding of crypto currencies, you will get started without any kind of worries. All a person need to do is have the valid email deal with and some time for you to invest.</p>

<p>The Method:</p>

<p>own your current rewards and increasing your balance.</p>

<p>two: Check out Paid-to-Click Internet sites</p>

associated with the revenue goes into the pockets of the people who view these ads.</p>

<p>3: Enjoy Browser Games</p>

<p>If you are a gamer and spend hours playing your preferred games online, you should earn money coming from this activity. Several browser-based games permit you to generate money in Bitcoin while playing and having fun.</p>

<p>Even though it's not the boring activity like watching videos or perhaps ads, the rewards will be typically the same. So, a person should have a look at this method as properly.</p>

<p>4: Get Involved in Mining</p>

<p>Should you be interested in mining, there is a good possibility which you didn't put in enough work. Since a lot of people don't recommend mining regarding earning crypto foreign currency anymore, be sure you acquire a rig 1st. Second, you should be prepared to pay high-energy bills. But the method we intend to talk about will be quite basic low-cost. In fact, you don't have to spend a dime. The majority of miners usually are scammers. Therefore, an individual should try this technique.</p>

A few check out more details about upon <a href=" https://topcryptofaucets.com"> bitcoin faucets</a>
"""

我尝试了以下代码,但都不起作用

代码语言:javascript
复制
element = driver.find_element(By.XPATH, '//div[contains(@id,"tinymce")]')
driver.execute_script(f"arguments[0].innerHTML = {HTML}", element)
driver.execute_script(f"arguments[0].innerHTML = '{HTML}'", element)
driver.execute_script('document.getElementsById("react-tinymce-0").setAttribute("innerHTML", arguments[0]);',HTML)

一直以来我都在

代码语言:javascript
复制
selenium.common.exceptions.JavascriptException: Message: javascript error: Invalid or unexpected token

寻找解决方案

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-09-24 21:16:44

代码语言:javascript
复制
driver.execute_script("arguments[0].innerHTML = arguments[1]", element, HTML)
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64045848

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档