admin管理员组文章数量:1130349
In selenium test automation, sometimes, when clicking on 'external' pdf links, I see the pdf load in a new window, and it seems to have a reasonable/readable URL in the address bar. However, when using driver.getCurrentUrl(), the return value is something like chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html. Any way to force the selenium driver to give me the actual url?
In selenium test automation, sometimes, when clicking on 'external' pdf links, I see the pdf load in a new window, and it seems to have a reasonable/readable URL in the address bar. However, when using driver.getCurrentUrl(), the return value is something like chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html. Any way to force the selenium driver to give me the actual url?
- I've never seen that... are you sure you are in the right window? You need to post a minimal reproducible example so we can repro the issue. – JeffC Commented Jan 23 at 23:31
- Thank you for the clue. I'm not convinced I am getting the window handles back from the selenium driver in the order expected. driver.getWindowHandles() returns a Set, and I had been able to reliably iterate through the set in the order in which members were added, but that does not seem to completely hold true with selenium-server-4.27.0, but haven't tested enough to be sure. Either way, I am able to ignore the handles with URLs that contain 'chrome-extension', and fish out the handle I want, and pull the URL from that one. – JackhammersForWeeks Commented Jan 24 at 1:25
1 Answer
Reset to default 0See comment above. Was getting inconsistent return values from driver.getWindowHandles() which was causing the wrong window to be switched to.
In selenium test automation, sometimes, when clicking on 'external' pdf links, I see the pdf load in a new window, and it seems to have a reasonable/readable URL in the address bar. However, when using driver.getCurrentUrl(), the return value is something like chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html. Any way to force the selenium driver to give me the actual url?
In selenium test automation, sometimes, when clicking on 'external' pdf links, I see the pdf load in a new window, and it seems to have a reasonable/readable URL in the address bar. However, when using driver.getCurrentUrl(), the return value is something like chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html. Any way to force the selenium driver to give me the actual url?
- I've never seen that... are you sure you are in the right window? You need to post a minimal reproducible example so we can repro the issue. – JeffC Commented Jan 23 at 23:31
- Thank you for the clue. I'm not convinced I am getting the window handles back from the selenium driver in the order expected. driver.getWindowHandles() returns a Set, and I had been able to reliably iterate through the set in the order in which members were added, but that does not seem to completely hold true with selenium-server-4.27.0, but haven't tested enough to be sure. Either way, I am able to ignore the handles with URLs that contain 'chrome-extension', and fish out the handle I want, and pull the URL from that one. – JackhammersForWeeks Commented Jan 24 at 1:25
1 Answer
Reset to default 0See comment above. Was getting inconsistent return values from driver.getWindowHandles() which was causing the wrong window to be switched to.
本文标签:
版权声明:本文标题:java - Selenium, the return value of driver.getCurrentUrl(), for pdfs, get things like 'chrome-extension:mhjfbmdgcfjbbpa 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1742025860a1905931.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论