UMB-CS-682-Team-03 / tracker

0 stars 0 forks source link

Test case 1 fails with ElementNotInteractableException for roundup-classhelper #66

Open rouilj opened 4 months ago

rouilj commented 4 months ago

test 1 is failing at:

        wait.until(
            EC.element_to_be_clickable((By.CSS_SELECTOR, 'input[name="keyword"] + roundup-classhelper'))).click()

with:

E       selenium.common.exceptions.ElementNotInteractableException: Message: Element <roundup-classhelper> could not be scrolled into view

I am confused by this error. I am not sure if it thinks it can't click on a roundup-classhelper and therefore it can't scroll a clickable roundup-classhelper into view or if something else is going wrong.

The css selector work when used in the console on the page with document.querySelector("input[name=keyword] + roundup-classhelper") so ....

The rest of the tests work after accounting for #65 .

rouilj commented 4 months ago

@patel-malav I could use some help with this and the other test issues if you have the time this week or next.

rouilj commented 3 months ago

Figured out what is going on, but not a good solution to it.

Apparently selenium thinks the link is off the screen on the right. If I comment out the selenium command to set the browser window size the failure doesn't occur.

So that's the workaround I am using for the test file I am bundling with Roundup.

I figured this out by triggering the debugger before the command that tried to click on the classhelper. Calling commands to get the classhelper item an the caling click() on the object failed with the error above. However if I manually resized the window width, .click() worked.

Running scrollIntoView:

        self.driver.execute_script("arguments[0].scrollIntoView(true);", classhelper);

or moveToElement

from selenium.webdriver.common.action_chains import ActionChains

classhelper = wait.until(
            EC.presence_of_element_located(
                (By.CSS_SELECTOR,
                 'input[name="keyword"] + roundup-classhelper'))
        )

actions = ActionChains(driver)
actions.move_to_element(classhelper).perform()

before calling classhelper.click() or

        wait.until(
            EC.element_to_be_clickable(
                (By.CSS_SELECTOR,
                 'input[name="keyword"] + roundup-classhelper'))
        ).click()

had no effect.

ref: https://stackoverflow.com/questions/41744368/scrolling-to-element-using-webdriver