2023-12-31

Capybara Element returned by Find method is taking a wrong coordinate

I have running a System Test with Ruby On Rails and Minitest, but an error is shown.

Error: enter image description here

edit: please copy and paste anything from a terminal rather than posting pictures ->

Error:
RequestsTest#test_Admin_User_should_create_request:
Selenium: :WebDriver: :Error: :ElementClickInterceptedError: 
  element click intercepted: Element <a id="request__tags-list" href="#" 
class="input-tag-items" dat a-action="click->input-tag box#itemsClick">...</a> is not clickable at point (686, 23). 
Other element would receive the click: <header class="request-panel-header" data-controller="request">…</header>
(Session info: chrome=120.0.6099.130)
test/system/requests_test.rb:480:in execute_test_new_request' 
test/system/requests_test.rb:54:in block in <class:RequestsTest>'

HTML:

<a id="request__tags-list" href="#" class="input-tag-items" data-action="click->input-tag-box#itemsClick"></a>

My Test:

tags_list = find("#request__tags-list")
puts tags_list.rect
tags_list.click  # click on link

I tried using click_link method but it didn't work either. The same error is shown.

I noticed that "tags_list.rect" prints coordinates that do not correspond to the tags_list coordinates.

#<struct Selenium::WebDriver::Rectangle x=316.6037902832031, y=31.733491897583008, width=739, height=20>

when in reality, the Y coordinate is much further down the page, 480 approximately.

Some idea what is happening.

Thanks!

SO: Windows 11

Ruby Version: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]

Rails Version: Rails 7.0.8



No comments:

Post a Comment