Selenium Webdriver Profile Save and save password how is it done?

Hi; Philipp @qqilihq

There are a few pages that I log in to specific, and it takes me a lot of time to enter a password and username every time. Is it possible to save this topic profile or save passwords?

I have read a record on this subject before, but I don’t know how. Do you have this feature?

Thanks

I think you could set a path to the profile (in case of Chrome/Chromium) using the user-data-dir flag. (use a custom capability chromeOptions{} -> args[] -> '--user-data-dir=/path/to/profile').

This should work. But I definitely do not recommend it, as the login information is no longer explicitly encoded in the workflows and you’re relying on a persistent state this way, which is brittle. Your workflows will break, should you e.g. switch the web browser, or should the profile get corrupted or deleted. Also (afaik?!) you cannot share one profile between parallel running instances.

Should you have to perform the same login steps in different workflows, consider using mechanisms such as metanodes for keeping your workflows maintainable by storing this logic at a central location.

I understand your warning yes this poses a risk. But since I only walk through my work, I have no worries about security.

I want to try it without breaking the existing structure. It will save me a lot of time if I can run it.

would you be able to submit a short sample workflow? not to contain private information. The example is useful for me to learn

Here’s a simple example with two variants how this can be done:

https://nodepit.com/workflow/com.nodepit.space%2Fqqilihq%2Fpublic%2Fforum%2FSelenium_Persistent_Profile_23416.knwf

In the first variant, I dynamically create the path to the profile directory using two Java nodes and the user.home property (this means, it should work on any platform without modification).

In the second example, I simply enter the path into the “Capabilities” section. I.e. you must adapt the path according to your environment and system (on Windows it would be C:\lalala instead of /Users/me/…)

– Philipp

1 Like

Thank you Philipp, yes, this works very well, but when I try to open the same page in two browsers at the same time, it gives an error. Is there a solution for this? I have to use the same profile or copy as I want to navigate through a few browsers.

Teşekküler

this solution will be very useful. Thanks again for the support
I solved the profile by duplicating it and showing the way. :+1:

image

Great to hear it works.

Alternatively you could actually also duplicate the profiles dynamically using the KNIME’s “File Handling” nodes Copy/Move Files I think (but I haven’t tried this myself :slight_smile: )

1 Like