forked from deepset-ai/haystack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved crawler support for dynamically loaded pages (deepset-ai#2710)
* Improved crawler support for dynamically loaded pages * Reduced scope of StaleElementReferenceException and removed deprecated code from WebDriver initialization * Improvements on crawler testing code * Code format and style applied on f028331 * Update Documentation & Code Style * Remove unused imports/parameters Co-authored-by: Sara Zan <sara.zanzottera@deepset.ai> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
19c4361
commit 9fe8e11
Showing
6 changed files
with
153 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Test Dynamic Page</title> | ||
</head> | ||
<body> | ||
<p>home page content</p> | ||
<div id="content"> | ||
<a href="index.html" id="a1">link to index</a> | ||
<a href="page_w_hidden_text.html" id="a2">link to page with hidden text</a> | ||
<a href="page1.html" id="a3">link to page 1</a> | ||
</div> | ||
<script> | ||
const updateTimeout = setTimeout(myUpdateFunction, 150); | ||
|
||
function myUpdateFunction() { | ||
const remElem = document.querySelector('#a2'); | ||
if (remElem) | ||
remElem.parentNode.removeChild(remElem); | ||
|
||
if (!document.querySelector('#a4')) { | ||
const newElem = document.createElement('a'); | ||
newElem.href = 'page2.html'; | ||
newElem.id = 'a4'; | ||
newElem.innerText = 'link to page 2'; | ||
document.body.appendChild(newElem); | ||
} | ||
|
||
clearTimeout(updateTimeout); | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
home page content | ||
|
||
link to index | ||
|
||
link to page 1 | ||
|
||
|
||
const updateTimeout = setTimeout(myUpdateFunction, 150); | ||
|
||
function myUpdateFunction() { | ||
const remElem = document.querySelector('#a2'); | ||
if (remElem) | ||
remElem.parentNode.removeChild(remElem); | ||
|
||
if (!document.querySelector('#a4')) { | ||
const newElem = document.createElement('a'); | ||
newElem.href = 'page2.html'; | ||
newElem.id = 'a4'; | ||
newElem.innerText = 'link to page 2'; | ||
document.body.appendChild(newElem); | ||
} | ||
|
||
clearTimeout(updateTimeout); | ||
} | ||
|
||
|
||
link to page 2 |