【发布时间】:2019-07-25 16:46:41
【问题描述】:
我是为了好玩而编程,所以我想通过 twitter 了解 selenium webdriver,但我遇到了一个问题。
所以我必须激活盒子上的元素并且效果很好:
TBot = webdriver.Chrome()
twitter_box_act = Tbot.find_element_by_xpath('//div[@class="public-DraftEditorPlaceholder-inner"]')
Tbot.execute_script("arguments[0].click(), twitter_box_act)
但是一旦我尝试在盒子上放一些文字,就会出现这个错误:
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
我用来尝试在框上放置文本的代码如下:
tweet_entry = self.bot.find_element_by_xpath('//span[@data-text="true"]')
tweet_entry.send_keys("some text here")
我尝试在没有解决问题的每个步骤之间放置一些 time.sleep(x)。
我尝试先编辑 br 标记,然后再编辑 span 标记,但仍然出现相同的消息错误
我一直在互联网上查看 Twitter 项目中的 selenium,但由于它们更改了 UI,因此 HTML 正文不同。
我错过了什么吗?
PS:我跳过了登录部分,因为这与问题无关
【问题讨论】:
标签: html python-3.x selenium-webdriver python-3.6