mozilla / FoxPuppet

Other
18 stars 17 forks source link

Add Bookmark Functionality #312

Open ben-c-at-moz opened 1 month ago

ben-c-at-moz commented 1 month ago

Add functionality to NavBar (and elsewhere) to set, unset, and retrieve bookmarks.

Refer to https://github.com/mozilla/fx-desktop-qa-automation/blob/main/modules/browser_object_navigation.py for ideas on what needs to be built and how to do it.

Add tests that exercise all methods. Make sure they run in make test and in CI.

Make sure the existing tests also pass using make test and in CI.

khabdrick commented 1 month ago

Hello there, can I take this up?

b4handjr commented 1 month ago

Hello there, can I take this up?

Please do

khabdrick commented 1 month ago

Message: Unable to locate element: [id="popup-notification-primary-button"]; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception.

I am getting the above error from the code below:

    @property
    def add_bookmark(self):
        """Adds a bookmark for the current page."""
        with self.selenium.context(self.selenium.CONTEXT_CHROME):
            bookmark_button = self.root.find_element(*self._bookmark_button_locator)
            # if not self.is_bookmarked:
            bookmark_button.click()  # Click to add bookmark
            self.root.find_element(
                By.ID, "popup-notification-primary-button"
            ).click()
            self.root.find_anonymous_element_by_attribute("anonid", "button")
            print("Page is already bookmarked.")

The work is a bit of a trial and error for me, so I want to know if it is possible to get a list of the elements I can access on the browser?

khabdrick commented 1 month ago

Like when I click the star button, there will be a popup and I want to click done there.

b4handjr commented 4 weeks ago

As it says, the element can't be found. I would check your CSS selector. What is self.root and can #popup-notification-primary-button be found from it? If not you can get another element to use as the root element to start your search.