Skip to content

Comments

Poll for active tab (and non-busy state)#9

Merged
alice merged 4 commits intoacacia-test-testdriverfrom
poll-active-tab
Jul 19, 2024
Merged

Poll for active tab (and non-busy state)#9
alice merged 4 commits intoacacia-test-testdriverfrom
poll-active-tab

Conversation

@alice
Copy link
Member

@alice alice commented Jul 10, 2024

Rather than waiting for the load complete event, poll for the active tab in a non-busy state or with a non-empty "title" attribute.

Copy link
Collaborator

@spectranaut spectranaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check out these recent changes, @alice ?

document_attributes = Atspi.Document.get_document_attributes(document)
if "Title" in document_attributes and document_attributes["Title"]:
return True
return False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so this is a little bit awkward, but polling only for the busy state doesn't work on Chromium family browsers. Additionally you can't just keep testing for the Title attribute, a new accessible object is created when the document is available.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof, I had a play with this and I see how we ended up here.

This seems about as good as we're likely to get unless we make a change to Chromium to expose the busy state.

I did notice we get a "URI" property as well as a title; I meant to comment on the Windows change that if we can check the URL rather than the title, that'll avoid some potential ambiguity.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll switch the window's PR to use the url, and open a new PR to check the URL here at that time.

document_attributes = Atspi.Document.get_document_attributes(document)
if "Title" in document_attributes and document_attributes["Title"]:
return True
return False
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof, I had a play with this and I see how we ended up here.

This seems about as good as we're likely to get unless we make a change to Chromium to expose the busy state.

I did notice we get a "URI" property as well as a title; I meant to comment on the Windows change that if we can check the URL rather than the title, that'll avoid some potential ambiguity.


def setup(self, product_name):
def setup(self, product_name, logger):
self.logger = logger
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change.

@alice alice changed the title WIP: Poll for active tab (and non-busy state) Poll for active tab (and non-busy state) Jul 18, 2024
active_tab = find_active_tab(root, product)
iterations += 1

logger.debug(f"Found ATSPI active tab in {iterations} iterations")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually thought we might as well leave this in here, it will only show up when debug logging.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair; I guess my thinking was that it's really only interesting if you're tuning the sleep time (which was why I added it), but I can imagine it might be useful if things start being really slow or something.

@alice alice merged commit 41ad1e2 into acacia-test-testdriver Jul 19, 2024
@alice alice deleted the poll-active-tab branch July 19, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants