[英]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.