I need to automate this following website: https://ekrs.ms.gov.pl/web/wyszukiwarka-krs/strona-glowna/index.html
When I work on my automation in my testing environment then all is fine, but in test I use "visible" normal mode.
But on enduser PC this should be run in headless mode, so I checked my code and I notice that with headless mode this website returns: The requested URL was rejected. Please consult with your administrator
Any concept why this issue occurs and how to solve this problem?
Thank you in advance
I also have this following information get back from WebDriver:
Starting ChromeDriver 96.0.4664.45 (76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch-heads/4664@{#947}) on port 9515 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. ChromeDriver was started successfully.
DevTools listening on ws://127.0.0.1:63205/devtools/browser/ffacc4cb-af7c-4157-881d-a8c7db522d30 [1206/145642.826:ERROR:command_buffer_proxy_impl.cc(125)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer. [1206/145645.262:INFO:CONSOLE(402)] "The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://...........goo.gl/7K7WLu", source: https://ekrs.ms.gov.pl/TSPD/08c5699bd4ab2000035ad69152344c2a5571187707e8019758fff5530615875b3778567088bde213?type=11 (402) [1206/145645.263:INFO:CONSOLE(402)] "The ScriptProcessorNode is deprecated. Use AudioWorkletNode instead. (https://.........bit.ly/audio-worklet)", source: https://ekrs.ms.gov.pl/TSPD/08c5699bd4ab2000035ad69152344c2a5571187707e8019758fff5530615875b3778567088bde213?type=11 (402) [1206/145645.264:INFO:CONSOLE(405)] "The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://...........goo.gl/7K7WLu", source: https://ekrs.ms.gov.pl/TSPD/08c5699bd4ab2000035ad69152344c2a5571187707e8019758fff5530615875b3778567088bde213?type=11 (405) [1206/145645.265:INFO:CONSOLE(408)] "The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://...........goo.gl/7K7WLu", source: https://ekrs.ms.gov.pl/TSPD/08c5699bd4ab2000035ad69152344c2a5571187707e8019758fff5530615875b3778567088bde213?type=11 (408) [1206/145645.265:ERROR:web_contents_delegate.cc(228)] WebContentsDelegate::CheckMediaAccessPermission: Not supported. [1206/145645.265:ERROR:web_contents_delegate.cc(228)] WebContentsDelegate::CheckMediaAccessPermission: Not supported. [1206/145645.306:ERROR:gl_utils.cc(318)] [.WebGL-0000249C00081B00]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels [1206/145645.467:ERROR:gl_utils.cc(318)] [.WebGL-0000249C00081B00]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels [1206/145645.564:ERROR:gl_utils.cc(318)] [.WebGL-0000249C00081B00]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels [1206/145645.652:INFO:CONSOLE(0)] "[.WebGL-0000249C00081B00]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels", source: https://ekrs.ms.gov.pl/TSPD/?type=20 (0) [1206/145645.652:INFO:CONSOLE(0)] "[.WebGL-0000249C00081B00]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels", source: https://ekrs.ms.gov.pl/TSPD/?type=20 (0) [1206/145645.654:INFO:CONSOLE(0)] "[.WebGL-0000249C00081B00]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels", source: https://ekrs.ms.gov.pl/TSPD/?type=20 (0)
EDIT: 2021/12/08
Finally I find out that a had to add capability user-agent
as Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36
. The interesting thing was that when I was used 60.0.3112.50
instead 96.0.4664.93
then my automation works well in Headless
when it come to navigate to the desired wegsite, but stoped to work on even in Normal
mode when it comes to using this website - I mean navigation to website works but after filling the form and submiting data I started to get the same issue ....consult administrator......
.
To clarify the matter:
Before I added args user-agent
in normal
mode works both navigate and search feature.
Before I added args user-agent
with outdated 60.0.3112.50
setting, in normal
mode works navigate but search stop working.
So now my question changes to:
Why, with out-of-date settings in user-agent
, the navigation to the page work properly, but the search on this page does not work? Could it just be related to the strange configuration, design of this site?
options.add_argument("disable-blink-features")
options.add_argument("disable-blink-features=AutomationControlled")
only these two lines are solution and now it work perfect