0

I am using the Firefox webdriver and I need it to save the history of browsed websites. I don't need to do anything with the history, I just need it to be there when I open the history page.

If there is a solution for other webdrivers that would be accepted too, though I would prefer a solution for Firefox.

My first thought was making a custom profile, but Selenium doesn't work with custom profiles, it just creates a new temp profile based on the custom profile.

I also went looking for the temp profile, but I couldn't find it. (Windows 7) I had hoped there would be a way to copy the temp data and place it in a different profile. Right before closing each session, I would then add the history to that profile.

My script is suppose to browse the computer like a normal user would. It self-browses the computer and internet using Python and Selenium. Using temp profiles is not 'normal user behaviour'.

I found some people asking the same question and they all accepted a different way to do what they wanted, but none of those do what I need.

esoleco
  • 74
  • 1
  • 7

1 Answers1

-1

create separated firefox profile using firefox profile manager (win+R and call "firefox -p") and use this profile in your selenium project on start firefox driver

ProfilesIni profile = new ProfilesIni();

FirefoxProfile myprofile = profile.getProfile("profileToolsQA");

WebDriver driver = new FirefoxDriver(myprofile);

profileToolsQA is your created profile in firefox profile manager

More detailed manual you can find here: http://www.toolsqa.com/selenium-webdriver/custom-firefox-profile/

Andrew_STOP_RU_WAR_IN_UA
  • 9,318
  • 5
  • 65
  • 101
  • I have tried this, but Selenium uses the settings of this profile and creates a temp profile, instead of actually using this profile. – esoleco May 27 '15 at 09:56
  • @esoleco, you misunderstood me: you need to attach the profile before browser will be started. Updated my solution with code – Andrew_STOP_RU_WAR_IN_UA May 28 '15 at 10:38
  • @Andrew You answer shows how to tell Selenium to use a specific profile. However, Selenium will take the profile you give to it, and then it will **copy this profile elsewhere** before starting Firefox, use **this copied profile** and then **delete the copied profile** after it is done running. Which is clearly *not* what the OP wants. – Louis May 28 '15 at 10:47
  • @Andrew It is exactly as Louis states. I know how to use a custom profile and I do use one. But Selenium works like Louis explains it; removing all data after you quit the browser. – esoleco May 28 '15 at 11:02
  • Louis: no, its not. Look here at the first and best comment/solution: http://stackoverflow.com/questions/6787095/how-to-stop-selenium-from-creating-temporary-firefox-profiles-using-web-driver . Due to this words its not create any temporary profile copy in this case. – Andrew_STOP_RU_WAR_IN_UA May 28 '15 at 11:33