mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-08-03 11:16:38 -04:00
More robust waiting for iframe to be ready
This commit is contained in:
parent
e846b3e07a
commit
185cb9c669
@ -285,7 +285,17 @@ function runTests (driver, modes, keepDriver) {
|
||||
} catch (e) {
|
||||
// Handle cases where the frame or element is not accessible
|
||||
await driver.switchTo().defaultContent();
|
||||
elementText = await driver.executeScript('var iframeDoc = document.getElementById("articleContent").contentDocument; return iframeDoc.getElementById("mwYw").textContent;');
|
||||
|
||||
// Wait for the iframe to be available before switching to it
|
||||
await driver.wait(until.elementLocated(By.id('articleContent')), 5000);
|
||||
await driver.switchTo().frame('articleContent');
|
||||
|
||||
// Wait for the target element to be available within the iframe
|
||||
const element = await driver.wait(until.elementLocated(By.id('mwYw')), 5000);
|
||||
elementText = await element.getText();
|
||||
|
||||
// Switch back to default content
|
||||
await driver.switchTo().defaultContent();
|
||||
}
|
||||
|
||||
// Assert that the article content matches the expected value
|
||||
|
Loading…
x
Reference in New Issue
Block a user