How can I remove the "Thanks for trying..." banner generated when I am printing to PDF using Selenium, with EdgeDriver and opening a URL in 'reader mode'?
How can I prevent that banner from printing when Example, you can paste this into Edge, then print to PDF: read://https://interestingengineering.com/innovation/jetoptera-air-taxi-flight-bladeless-fans-vtol
You will see the banner at the top.
While messing with the Reader mode in Edge manually, it turns out that banner is at the bottom of the page (until you enable print preview) and if you hit the "x" it seems to stay away, at least for now...
So in EdgeDriver / Selenium, how can I hide the banner CSS element before engaging print?
I think I am close by using:
driver.execute_script("document.getElementById('__reading__mode__sendfeedback').style.display = 'none'")
but I get a javascript
error because it supposedly cannot find that Element ID:
javascript error: Cannot read properties of null (reading 'style')
(Session info: MicrosoftEdge=110.0.1587.63)
For reference, the banner info from Inspecing (HTML?)
<div id="__reading__mode__sendfeedback" dir="ltr"><hr class="c011 __reading__mode__feedback__separator"><div id="__reading__mode__feedback__message__id"><div id="__reading__mode__feedback__inner__message__id" role="group" aria-labelledby="__reading__mode__feedback__query_id"><span class="__reading__mode__feedback__text" aria-live="assertive" aria-atomic="true"></span><span class="__reading__mode__feedback__text" id="__reading__mode__feedback__query_id">We’d love your feedback on Immersive Reader. Did content appear properly on this webpage?</span><button class="c012 __reading__mode__feedback__button" id="__reading__mode__feedback__yes__button" title="Yes"><span class="c018"><svg width="40" height="32" viewBox="0 0 40 32" xmlns="https://www.w3.org/2000/svg" class="" aria-hidden="true"><path d="M24.4215 9.19868C24.4215 6.75675 23.2814 5 21.4151 5C20.3889 5 20.0368 5.60136 19.6689 6.99957C19.5938 7.28842 19.5569 7.42906 19.5179 7.56767C19.4169 7.9264 19.2411 8.53716 18.9909 9.39868C18.9842 9.42176 18.9743 9.4435 18.9615 9.46358L16.0947 13.9492C15.4166 15.0102 14.4162 15.8257 13.2403 16.2759L12.767 16.4571C11.5203 16.9345 10.7964 18.2382 11.0506 19.5488L11.4551 21.6349C11.6965 22.88 12.6402 23.8709 13.872 24.1728L21.4997 26.0423C24.0309 26.6627 26.5893 25.1278 27.2332 22.6025L28.6481 17.0533C29.0916 15.314 28.0411 13.5445 26.3018 13.1011C26.0394 13.0342 25.7697 13.0003 25.4988 13.0003H23.6755C24.1716 11.3674 24.4215 10.1076 24.4215 9.19868ZM12.5231 19.2633C12.4076 18.6676 12.7366 18.0749 13.3033 17.858L13.7766 17.6768C15.2522 17.1118 16.5077 16.0884 17.3586 14.757L20.2254 10.2713C20.3154 10.1305 20.3848 9.9774 20.4314 9.81684C20.6827 8.95183 20.8594 8.33784 20.9618 7.97395C21.0049 7.8207 21.0458 7.66525 21.1195 7.38128C21.3094 6.65958 21.4028 6.5 21.4151 6.5C22.2828 6.5 22.9215 7.48407 22.9215 9.19868C22.9215 10.0832 22.5957 11.5341 21.9377 13.5138C21.7763 13.9993 22.1377 14.5003 22.6494 14.5003H25.4988C25.6447 14.5003 25.7899 14.5186 25.9312 14.5546C26.8678 14.7934 27.4334 15.7462 27.1946 16.6827L25.7797 22.2319C25.3391 23.9597 23.5887 25.0099 21.8568 24.5855L14.2291 22.7159C13.5658 22.5534 13.0576 22.0198 12.9276 21.3494L12.5231 19.2633Z"></path></svg></span></button><button class="c012 __reading__mode__feedback__button" id="__reading__mode__feedback__no__button" title="No"><span class="c018"><svg width="40" height="32" viewBox="0 0 40 32" xmlns="https://www.w3.org/2000/svg" class="" aria-hidden="true"><path d="M24.6737 22.0352C24.6737 24.3411 23.5972 26 21.8348 26C20.9142 26 20.5682 25.4874 20.2379 24.3042L20.0433 23.5754C19.948 23.2366 19.7819 22.6599 19.5457 21.8464C19.5394 21.8245 19.53 21.804 19.5179 21.7851L16.8108 17.5493C16.1706 16.5475 15.2258 15.7774 14.1155 15.3522L13.6686 15.1811C12.4913 14.7304 11.8078 13.4993 12.0478 12.2617L12.4297 10.2918C12.6577 9.11612 13.5488 8.18043 14.712 7.89533L21.9147 6.12996C24.3049 5.54413 26.7208 6.99354 27.3288 9.37818L28.6649 14.6182C29.0837 16.2605 28.0917 17.9314 26.4493 18.3502C26.2015 18.4134 25.9468 18.4453 25.691 18.4453H23.9693C24.4378 19.9872 24.6737 21.1769 24.6737 22.0352ZM13.4383 12.5313C13.3292 13.0939 13.6399 13.6535 14.175 13.8584L14.6219 14.0295C16.0153 14.563 17.2009 15.5294 18.0044 16.7865L20.7114 21.0223C20.7964 21.1553 20.8619 21.2999 20.9059 21.4515L21.4271 23.2648L21.627 24.012C21.7586 24.4728 21.8249 24.5836 21.8348 24.5836C22.6542 24.5836 23.2573 23.6543 23.2573 22.0352C23.2573 21.2 22.9497 19.8298 22.3283 17.9605C22.1759 17.5021 22.5172 17.0289 23.0004 17.0289H25.691C25.8288 17.0289 25.9659 17.0117 26.0993 16.9777C26.9837 16.7522 27.5178 15.8525 27.2923 14.9682L25.9563 9.72815C25.5402 8.09655 23.8873 7.10484 22.2519 7.50567L15.0492 9.27104C14.4228 9.42456 13.943 9.92839 13.8203 10.5615L13.4383 12.5313Z"></path></svg></span></button></div></div></div>
It looks like you have got the wrong ID. Check this one:
driver.execute_script("document.getElementById('__reading_mode_microfeedback_container_id').style.display = 'none'")