Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of synthetic navigation to HTTP driver #489

Open
ziflex opened this issue Apr 30, 2020 · 4 comments
Open

Add support of synthetic navigation to HTTP driver #489

ziflex opened this issue Apr 30, 2020 · 4 comments
Labels
area/drivers/http Http driver area/drivers HTML drivers good first issue Good for newcomers type/enhancement New feature or request

Comments

@ziflex
Copy link
Member

ziflex commented Apr 30, 2020

Right now, pages created by in-memory http driver does not support navigation between pages due to their static nature.
It makes it problematic to "move" from one static page to another within a same domain simply because we cannot reuse current page. In order to do so, we have to create a new page every time we need to move from A to B.
Let's add a possibility to reuse existing page by implementing synthetic navigation that would just download a new HTML page by a given URL and replace root element.

@ziflex ziflex added type/enhancement New feature or request good first issue Good for newcomers area/drivers/http Http driver area/drivers HTML drivers labels Apr 30, 2020
@slowmanchan
Copy link
Contributor

Would love to help out here but I'm not too sure whats required here. Could you please elaborate a bit more? Thanks!

@ziflex
Copy link
Member Author

ziflex commented Jun 3, 2022

Great!
So, we have a main Page interface as an abstraction and 2 implementations aka drivers:

CDP driver is a "remote control" to your browser where all pages are loaded and interactions occur.
But HTTP driver just loads HTML pages into memory and parses them, hence no user interactions like clicking and selecting can happen. But, some of the interactions can be emulated and one of the interactions is navigation between pages.
With CDP driver, you can just write NAVIGATE(page, newUrl) and it will navigate the current page/browser tab to a new location. HTTP driver does not do it but it does not mean it cannot. We can simply load a new page and flush the previous one. That's basically what this issue is about.

You can see here that the method exists but is not implemented. (the ignored argument is a target URL).

@slowmanchan
Copy link
Contributor

Thanks for the info.
I'll check it out!

@slowmanchan
Copy link
Contributor

I've got a WIP PR. It works but is this what you mean? Also, can you let me know what your development process is? I'm currently compiling after code changes and testing manually with an .fql file. I'd also like to cover this with some tests but i'm not sure how to go about it (mocking drivers / objects).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/drivers/http Http driver area/drivers HTML drivers good first issue Good for newcomers type/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants