I am trying to get some to some pages in kibana through selenium/crome dirver. I have seen some samples from some time ago where providing the user/pwd in the url worked, but now, if I do this, still gets me to the page where you get:
Log in with Elasticsearh / Log in with Elastic Cloud
Being a newbie in selenium stuff, not sure if this is easy to overcome with selenium, anyone has done it?
Yeah I saw you guys do something like that in those tests, but forgot to mention I am using selenium from python, no idea how mess with that typescript code...
Technically what you need is to know the proper sequence of actions to perform a login and the right CSS selectors, that should be relative easy to figure from our TypeScript code base and port to Python even if TS isn't your language of choice for day to day work
So yeah, I'd encourage you to try and experiment, and if you're really stuck feel free to tag me here.
I really appreciate the help Oleg! I tried for some hours but I see it's are rough field for me, not my area of expertise at all... Will resort to google once in a while (and checking here) see if someone solves my exact issue, and meanwhile will try to find a plan B.
oh sure...I am trying to programmatically get a screenshot of an index monitoring advance page...it would be great if there was a simpler way I'm unaware of
But if you don't have anything like this in Python, you most likely just need to add Authorization header to your request, and that should do the job (that's what Puppeteer basically does with page.authenticate method):
Authorization: Basic base64(username:password)
For example for elastic user with changeme password it'd be:
Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==
Alternatively you can use Kibana monitoring APIs to get the data itself, but I guess you need a pretty picture
Doing tests but always get the snapshot of a loading page, does it need to be some
page.waitFor...()
Yep, that's correct, if you don't have any Kibana Spaces (just default one), then you'd first need to wait for the Kibana chrome to appear (follow the link to see the selector we use and timeout may need to be large enough).
And then you may need to wait for a particular Monitoring app section. I'm not working with this app, so cannot really suggest much, but take a look at these test files. There you can find files for various parts of the Monitoring application and every file contains more or less descriptive CSS selectors for the app regions that you can waitFor.
Note that the links I've shared are for master branch, switch to the proper git tag (e.g. 7.12.0) depending on the Kibana version you're running puppeteer against.
I'm pretty sure that you're using the wrong URL now, maybe you're missing the full hash fragment (that's super important for Kibana)?
You can console.log the URL in your puppeteer script and then try to use it in the private/anonymous browser tab to make sure it really leads to where you expect.
I checked your last selector (used in my gist as well) and it seems to work properly for the random index in my test Cloud deployment.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.