Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/348.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 向文本区标题选择发送键_Python_Selenium_Web Scraping - Fatal编程技术网

Python 向文本区标题选择发送键

Python 向文本区标题选择发送键,python,selenium,web-scraping,Python,Selenium,Web Scraping,我正在尝试使用Selenium python将一些文本发送到Google Adwords的搜索文本区域 手动输入时,textarea中的文本将转到其属性“title”。 文本区域如下所示: <textarea class="spl-a sprb-c spl-d" rows="1" id="gwt-debug-keywords-text-area" aria-labelledby="gwt-uid-94 gwt-uid-74" wrap="off" style="overflow: hidd

我正在尝试使用Selenium python将一些文本发送到Google Adwords的搜索文本区域

手动输入时,textarea中的文本将转到其属性“title”。 文本区域如下所示:

<textarea class="spl-a sprb-c spl-d" rows="1" id="gwt-debug-keywords-text-area" aria-labelledby="gwt-uid-94 gwt-uid-74" wrap="off" style="overflow: hidden;" dir="ltr" title="mytext"></textarea>

产生

selenium.common.exceptions.ElementNotVisibleException: Message: element not visible
是否有其他方法将密钥发送到此搜索文本区域?我有像500个关键字,我需要抓取数据

文本区的完整代码:

<div class="spl-c spI-d" style="width: 575px;">
<div id="gwt-uid-119" class="sprb-a">
<div class="sprb-b spl-b" style="display: none;" aria-hidden="true">For example, flowers or used cars</div>
<textarea id="gwt-debug-keywords-text-area" class="spl-a sprb-c spl-d" rows="1" aria-labelledby="gwt-uid-139 gwt-uid-119" style="overflow: hidden;" dir="ltr" title="my keyword" wrap="off"></textarea>
</div>
</div>
</div>

例如,鲜花或二手车

您尝试与之交互的元素可由Selenium寻址,因为它位于一个隐藏的div中-此div:

<div class="sprb-b spl-b" style="display: none;" ...

你能帮我一个忙,试着打开控制台窗口,运行以下脚本$(“#textarea”).val(“mytext”).change();您的代码错误,textarea不是id,而是标记,val不是函数。jquery与SeleniumWebDriver有什么关系?您不使用id有什么原因吗?您是否已验证
TEXTAREA
是页面上唯一的区域?在Chrome开发控制台中尝试
$$(“textarea”).length
,看看它是否返回1。我的猜测是没有,可能是DOM中的第一个不可见。我尝试了id ofc,只是复制粘贴了标记名,因为这是我最后一次尝试。在最初的问题中也添加了这一点$$(“textarea”).length->trued,它返回它返回???你的答案没有公布。
<div class="spl-c spI-d" style="width: 575px;">
<div id="gwt-uid-119" class="sprb-a">
<div class="sprb-b spl-b" style="display: none;" aria-hidden="true">For example, flowers or used cars</div>
<textarea id="gwt-debug-keywords-text-area" class="spl-a sprb-c spl-d" rows="1" aria-labelledby="gwt-uid-139 gwt-uid-119" style="overflow: hidden;" dir="ltr" title="my keyword" wrap="off"></textarea>
</div>
</div>
</div>
<div class="sprb-b spl-b" style="display: none;" ...