简体   繁体   English

我正在尝试 select 一个盒子中的图像,然后使用 selenium python 单击对齐按钮

[英]I am trying to select an image from a box and then click on the aligning button using selenium python

Here is the code for the image I uploaded这是我上传的图片的代码

<body id="tinymce" class="mce-content-body " data-id="textarea-WYSIWYG" contenteditable="true"><p><br data-mce-bogus="1"></p><p><a href="//www.shahidpro.tv/uploads/articles/60011c78.jpg" rel="prettyPhoto[phpmelody]"><img src="//www.shahidpro.tv/uploads/articles/60011c78.jpg" width="500" height="500" vspace="" hspace="" border="0" alt=""></a></p></body>
  <p><a href="//www.shahidpro.tv/uploads/articles/60011c78.jpg" rel="prettyPhoto[phpmelody]"><img src="//www.shahidpro.tv/uploads/articles/60011c78.jpg" width="500" height="500" vspace="" hspace="" border="0" alt=""></a></p>

I tried using我尝试使用

clk = WebDriverWait(browser, 30).until(EC.invisibility_of_element_located((By.XPATH, '/html/body/p[2]/a"]'))).click()

and

clk = WebDriverWait(browser, 30).until(EC.invisibility_of_element_located((By.XPATH, '//*[@id="tinymce"]/p[2]/a'))).click

and by partial link text using (//www.shahidpro.tv/uploads/articles/) but It doesn't click nor give error.并通过使用 (//www.shahidpro.tv/uploads/articles/) 的部分链接文本,但它不会点击也不会出错。 I am pretty new to selenium and python我对 selenium 和 python 很陌生

.invisibility_of_element_located : .invisibility_of_element_located

An Expectation for checking that an element is either invisible or not present on the DOM.用于检查元素是否不可见或不存在于 DOM 中的 Expectation。 locator used to find the element用于查找元素的定位器

The question is why do you want to wait for the element to disappear then click?问题是为什么要等元素消失再点击呢?

Maybe what you need is .visibility_of_element_located or more precisely is .element_to_be_clickable也许您需要的是.visibility_of_element_located或更准确地说是.element_to_be_clickable

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

相关问题 我正在尝试使用 Selenium 单击嵌套 div 中的按钮 - I am trying to click a button that is inside nested divs using Selenium 在 Python 中使用 Selenium 单击/选择单选按钮 - Using Selenium in Python to click/select a radio button 我试图使图像旋转单击按钮 - I am trying to make an image rotate on a button click selenium.common.exceptions.TimeoutException:当我尝试使用python进行按钮单击时,将出现此错误 - selenium.common.exceptions.TimeoutException: this error will getting when I'm trying to button click using python 尝试使用Selenium Web驱动程序单击Python中的按钮 - Trying to click a button in Python using Selenium Web Driver 试图点击按钮给我一个错误。 我正在使用 repl.it python 环境 - Trying to click on button gives me an error. I am using repl.it python environment 尝试使用Selenium WebDriver在消息框中单击 - Trying to click in the message box using selenium webdriver 单击一个按钮在 python selenium 中显示一个文本框 - Click a button to display a text box in python selenium 无法使用Selenium WebDriver和Python选择/单击按钮 - Can't select / click button using Selenium WebDriver w Python 如何使用 Selenium Python 选择/单击单选按钮 - How to select/click radio button using Selenium Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM