简体   繁体   English

我如何使用JavaScript看到textarea框

[英]how i can visible textarea box using javascript

I'm making automation script in python using selenium so i want to visible textarea box because i want to put it into some arguments and i'm using this code: 我正在使用selenium在python中制作自动化脚本,所以我想显示textarea框,因为我想将其放入一些参数中,并且正在使用以下代码:

element = driver.find_element_by_id('g-recaptcha-response')
driver.execute_script("arguments[0].style.display = '';", element)
driver.execute_script("arguments[0].style.margin = '100px 200px';", element)

but above code is not working for me as you can see here: 但是上面的代码对我不起作用,您可以在此处看到:

在此处输入图片说明

Could you please tell me how I can show textarea box? 你能告诉我如何显示文本框吗? Link to the page . 链接到页面

arguments[0].style.display = 'block';
arguments[0].parentNode.parentNode.style.display = "block";

The problem is that setting style.display to an empty string is interpreted as setting the display to "none" and that makes the element invisible. 问题在于,将style.display设置为空字符串会被解释为将display设置为“ none”,这会使元素不可见。 The textarea also sits in a parent which sits in a parent with the styling "display: none" so to solve that just go to the parent of the parent and set its display to "block". 文本区域也位于父级中,而父级的样式为“显示:无”,因此只需转到父级的父级并将其显示设置为“阻止”即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM