I cannot make it scroll correctly while trying to handle:
Caused by: org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <a class=“btn btn-sm btn-primary w-100” href=“XXXXXX” is not clickable at point (1233, 15). Other element would receive the click: <nav class="navbar navbar-expand-md
and I’ve seen multiple topics about this here that basically just advise to use JS.
Before using JS, I’d like to know whether or not this is the only option and I shouldn’t even try using scrolling in Katalon to handling that.
Yes, I did. It doesn’t seem to be working at all. Scrolling to the position (0,0) seems to be doing some scrolling but not to the very top of the page. So, the element I need to click is still not shown.
If you provide more information when asking questions it would really help but first thing I would check is that the element that you think you are scrolling to is correct. Have you checked the locator method you are using in Chrome Dev Tools for example? Is it unique?
Please read the following guidance and understand how to help us help you.
Please understand that you should provide enough information. Let me enumerate:
Please show your Test Case script. At least show the lines where you call WebUI.scrollToElement(TestObject testObject, int timeout)
Possibly you refer to a TestObject as the 1st argument to the scrollToElement(TestObject, …). Please show us how the TestObject is defined, how its locator (XPath expression or CSS Selector) looks like.
If the target URL is public, let us know.
If the target URL is not public, please show us the HTML source code of your target Web page. Please let us know which HTML element you want to locate by your TestObject.
Which HTML element in the web page does your locator (XPath, CSS Selector) actually locate? Can you explain it to us?
If you wonder how to share the HTML, please save the web page into a MHTML (MIME HTML) file using Chrome browser and post it here. In Chrome browser having your target HTML opened, do right click on a page; then in a drop down menu you will see “Save as” menu; you want to choose “Save as” which calls up a dialog where you can select to “save as, Webpage, Single file”; do save it. You will get a file. That’s a MHTML file. With the MHTML file shared here, people in this forum would be able to reproduce your web page on their machine without network connection to the web server. With your web page in hand together with your script and TestObject disclosed, they would be able to understand your problem correctly, and hopefully find some useful advice to you.
I guess that you have never studied the XPath and CSS Selector technology, therefore you do not understand the locators in TestObjects generated by Katalon’s “Web Record” tool; you just rely on the tool expecting the tool to provide you with good TestObjects with correct locators auto-magically.
Unfortunately life is not that easy. The “Web Record” tool generates TestObjects but these are rarely satisfactory. Tools will get you started quickly — it is a great benefit though — and no more. You are supposed to review, refine, rewrite the locators of generated TestObjects manually. In order to do the job, you need to train yourself for HTML/XPath/CSS Selector technology.
I would recommend you to step back, sit tight and read some documents about the basics of XPath and CSS technology. There are a few useful/free articles on the Internet: