How do I "get" an element from the HTML that is a "data-index" on Selenium IDE webdriver (Chrome)? - selenium

I want to do a click on somethink in a website, but the problm is that I get an error: Element <td style="">...</td> is not clickable at point (366, 304). Other element would receive the click: <div class="fixed-table-loading" but where I want to click, does not have a class, it only have's a data-index what can I use to "click" on it ?

You can use below css selector for finding that element,
tr[data-index='0']
However the error "Element <td style="">...</td> is not clickable at point (366, 304). Other element would receive the click: <div class="fixed-table-loading"" you are getting is not means that you doing false operation, it means that where selenium find your desired element to click, there is already a different element on that position and it will be getting that click.
So, first you need to focus on your element or if it is a member of a dropdown or opening list you need to first open that dropdown and then you should have click your element.

Related

What would be the cause of clicking failure in selenium for this checkbox?

I have a page as this,
And I want to click the top checkbox, which by default, would automatically select all the checkboxes in that list. As you can see, I have created the xpath value, and it matches the checkbox area that I want to pick. But when I was to have it executed in selenium, the checkbox checking never happens.
xpath_var = "//th[#class='selection-cell-header']/div[1]/input[1]"
WebDriverWait(self.driver, 30).until(
EC.element_to_be_clickable((By.XPATH, xpath_var,))).click()
And here is the exception I have received:
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <input class="ftnt-checkbox" readonly="" type="checkbox" id="" value=""> is not clickable at point (305, 162).
Other element would receive the click: <label for="ftnt-checkbox"></label>
Any idea what could be wrong ? work around for such case? Manual clicking was ok, in that case.
Thanks,
Chun
The exception message indicates that there is another element that will receive the click. This is a kind of protection in Selenium.
You can try to click this label that is on top of your element. Or click the parent div. Or click your element with JavaScript.
WebElement element = driver.findElement(By.id("gbqfd"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
Reference:
How to click an element in Selenium WebDriver using JavaScript?

Selenium can't click element obscure by "overlay" element

selenium.common.exceptions.ElementClickInterceptedException: Message: Element <select id="buttonmodule" class="x2j" name="buttonmodule"> is not clickable at point (437,425) because another element <div id="overlay" class="r1_hide_busy_status r1_show_busy_status"> obscures it
Message: Element <select id="buttonmodule" class="x2j" name="buttonmodule"> is not clickable at point (437,425) because another element <div id="overlay" class="r1_hide_busy_status r1_show_busy_status"> obscures it
I tried to find element id="buttonmodule" to click but I got message that it is not clickable by overlay element
XPATH of buttonmoduel: "//a[contains(text(),'buttonmodule')]
info of overlay: <div id="overlay" class="r1_hide_busy_status" style="height: 967px; width: 1853px;" xpath="1"></div>
According to my perception, your selected element is a dropdown developed using the select tag. Basically dropdown is developed using select tag will work by using selectByVisibleText() or selectByValue() or selectByIndex() methods as these are default methods to select values in the dropdown.
And we need to locate the dropdown and pass that object reference as an argument for select class nothing but associating both.
For example:-
Webelement dd =
driver.findElement(By.xpath("//div[#id='buttonmodule']"));
Select s=new Select(dd);
s.selectByVisibleText("2");

ElementClickInterceptedException Selenium unable to click button Python [duplicate]

This question already has answers here:
Element MyElement is not clickable at point (x, y)... Other element would receive the click
(5 answers)
Closed 2 years ago.
I'm writing a selenium test that clicks on a specific button on a page. There are no other buttons present on the page but it seems like it's been obstructed so the codes unable to find it.
I've tried to maximum the page in the hope it can find the button but it's unable to do so
My code
driver.maximize_window()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[#id='save' and #name='save'][#value='View Report']"))).click()
copy of the element
<input type="submit" value="View Report" id="save" name="save" data-reportid="108">
Error
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (1750, 770). Other element would receive the click: ...
(Session info: chrome=83.0.4103.116)
I think that another element may be overlapped your element, and you should wait for the invisibility of this layer. The layer can be a loading frame or anything else.
WebDriverWait(driver, 20).until(EC.invisibility_of_element((By.CSS_SELECTOR, "selector_for_ovelapped_layer")))
and then click the element you needed
Also, you can use Actions:
element = driver.find_element_by_xpath("//input[#id='save' and #name='save'][#value='View Report']")
webdriver.ActionChains(driver).move_to_element(element).click(element).perform()
And you can do this with JSExecutor:
element = driver.find_element_by_xpath("//input[#id='save' and #name='save'][#value='View Report']")
driver.execute_script("arguments[0].click();", element)

How to click on the center of the button using selenium java? Which position of the button is actually getting clicked when button is identified?

I have button in our website, and border areas of the button is not clickable. So, i need to make sure the button is getting clicked at the center. Is it possible via selenium?
I tried using coorinates, but it is not recommended for our scenario.
xpath used : //div/button[#id='clickme']
<div class="col-lg-10 col-sm-12 p-0 pt-4">
<button class="click mb-3 " tabindex="0" id="clickme">+ Click Here</button>
</div>
Java code used to click
WebElement button = driver.findElement(By.id("clickme"));
button.click();
I guess the click is happening sometimes[2 out of 10 times] on the border where it is not clickable(hand symbol not shown) . As a result report says the click action happened, but there is no event fired on the website.
To identify the element with text as Click Here you can use either of the following Locator Strategies:
cssSelector:
"button.click#clickme"
xpath:
"//button[contains(#class, 'click') and #id='clickme'][contains(., 'Click Here')]"

How to click on the element as per the html through VBScript and Selenium

I'm using VbScript with Selenium driver to connect to Chrome (store.steampowered.com/app/681530/NOISZ/) and want to click the "Next in Queue" button which is a div class, but nothing happens. I know I'm on the right track because the below lines does work as expected:
(Displays the text Next in queue)
msgbox(driver.FindElementsByXPath("//div[#class='next_in_queue_area']/div[#class='btn_next_in_queue btn_next_in_queue_trigger']").Item(1).text)
(Scrolls to the Next in queue button)
driver.FindElementsByXPath("//div[#class='next_in_queue_area']").Item(1).ScrollIntoView
(But trying these ones does nothing and also no error messages)
driver.FindElementsByXPath("//div[#class='queue_actions_ctn']").Item(1).Click
driver.FindElementsByClass("next_in_queue_content").Item(1).Click
Using Chrome's Inspect when highligtning this code the Next button is highlighted entirely:
<div class="btn_next_in_queue btn_next_in_queue_trigger" data-tooltip-text="Remove this product from your queue and continue to the next item.">
<div class="next_in_queue_content">
<span>Next in Queue<br>
<span class="queue_sub_text">(11 remaining )</span>
</span>
</div>
</div>
So it is just a question of finding the correct div or span to click
To click the button with text as Next in Queue you can use either of the following solution:
FindElement with XPath:
driver.FindElementByXPath("//div[#class='btn_next_in_queue btn_next_in_queue_trigger']/div[#class='next_in_queue_content']/span").Click
FindElements with XPath:
driver.FindElementsByXPath("//div[#class='btn_next_in_queue btn_next_in_queue_trigger']/div[#class='next_in_queue_content']/span").Item(1).Click
As an alternative you can use the ExecuteScript() method as follows:
Dim js As IJavaScriptExecutor = TryCast(driver, IJavaScriptExecutor)
js.ExecuteScript("arguments[0].click();", driver.find_element_by_xpath("//span[starts-with(#id, 'button-')][#class='x-btn-inner x-btn-inner-center']"))
Or
Imports OpenQA.Selenium.Support.Extensions
driver.ExecuteJavaScript("arguments[0].click();", driver.find_element_by_xpath("//span[starts-with(#id, 'button-')][#class='x-btn-inner x-btn-inner-center']"))