#selenium

/

      • madhu has quit
      • chibbz has quit
      • madhu joined the channel
      • testingbot joined the channel
      • cravecode has quit
      • testingbot has quit
      • cravecode joined the channel
      • saucyallison joined the channel
      • madhu has quit
      • madhu joined the channel
      • andrewtayler has quit
      • cravecode has quit
      • saucyallison has quit
      • madhu__ joined the channel
      • madhu has quit
      • maumercado joined the channel
      • maumercado
        Hello, Im looking for a way to reuse a user session with selenium.. what Im trying to do is: open say instagram, login, then quit driver(), then open again a new selenium session but as if it was the same user as before, then quit selenium driver again, so far Ive tried getting the cookies from the previous selenium session and add them to the new one but no luck, can anyone help me figure this out ?
      • ... Im using selenium-webdriver in nodejs
      • dolu has quit
      • philipp_k joined the channel
      • philipp_k has quit
      • harryh has quit
      • testingbot joined the channel
      • Hello123321
        2,0i tried also to do something like that, but in twitter, i didn't put much effort on this, so i didn't magnage to do that
      • 2,0you already saved the cookie?
      • maumercado
        yup I got the cookies, and then add them to the new selenium session but no luck :/
      • Hello123321
      • 2,0you followed this one?
      • 2,0(it's in python)
      • maumercado
        yeah its the same idea, it just looks worst in node with the callbacks hell thing happening
      • :)
      • testingbot has quit
      • it adds the cookies to the session, same ones, but when opening the main url, it gives me the instagram login form, might be theres something Im missing
      • Hello123321
        2,0hooo , right, you're using node
      • 2,0you do also a bot?
      • madhu__ has quit
      • madhu joined the channel
      • maumercado
        a bot?
      • Hello123321
        2,0bot that login to insta' and do "bla bla bla"
      • maumercado
        yeah kinda.. is just a proof of concept that I wanna do using instagram
      • after that move into bigger things... but the session/cookies reuse will come in handy
      • :)
      • farlan has quit
      • Hello123321
        2,0nice
      • farlan joined the channel
      • maumercado
        hrmm... Ive found a lot of sites that mention the use of firefox profiles ... might give that a shot if I cannot get the cookies thing to work
      • Hello123321
        2,0you must use node?
      • madhu has quit
      • maumercado
        I could use python as well... but yeah what Im doing right now is mostly node...
      • TacticSiege joined the channel
      • Hello123321
        2,0yes
      • 2,0python has many examples
      • maumercado
        yep Ive seen that... but once you get the gist of it, you can translate from one language to the other :)
      • anth0nyc has quit
      • pjdelport has left the channel
      • maumercado has quit
      • kggr joined the channel
      • philipp_k joined the channel
      • philipp_k has quit
      • testingbot joined the channel
      • testingbot has quit
      • otigranko has quit
      • lukeis joined the channel
      • lukeis has quit
      • btulchinsky has quit
      • Hello123321 has quit
      • lukeis joined the channel
      • realz has quit
      • geheimnis` joined the channel
      • btulchinsky joined the channel
      • p0deje joined the channel
      • nirvdrum has quit
      • chibz joined the channel
      • realz joined the channel
      • chibbz joined the channel
      • testingbot joined the channel
      • tony4 has quit
      • chibz has quit
      • testingbot has quit
      • chibz joined the channel
      • chibbz has quit
      • smccarthy joined the channel
      • chibz has quit
      • chibz joined the channel
      • philipp_k joined the channel
      • philipp_k has quit
      • testingbot joined the channel
      • p0deje has quit
      • p0deje joined the channel
      • testingbot has quit
      • SpaceDino joined the channel
      • rafajafar joined the channel
      • rafajafar
        [Python] hey I've been digging for an answer to this for a while. I need to prevent navigation away from the page entirely but capture the URL. I can do that... except for one hitch... when I call "window.stop();" in a before_navigate_to() call in an AbstractEventListener, the driver.get(url) call that comes after blocks
      • I'm in here because I'm super in a crunch period and could really use some help
      • SpaceDino has quit
      • is there a way to prevent driver.get() from blocking? ChromeDriver for Python
      • realz has quit
      • kggr has quit
      • realz joined the channel
      • madhu joined the channel
      • lukeis
        rafajafar: try setting the page load timeout http://stackoverflow.com/a/31165861/725944
      • rafajafar
        I did that but it's not throwing an error, just hanging
      • set the timeout to a fraction of a second
      • lukeis
        warning, your driver.get will throw an exception (a timeout exception), but you should be able to catch it and continue
      • rafajafar
        chromedriver v21
      • I can show you the snippet I'm using
      • chibz has quit
      • lukeis
        sure :)
      • and you mean 2.21?
      • rafajafar
        yes
      • sorry
      • philipp_k joined the channel
      • lukeis: gimme one sec, trying to figure out how to make this best legible
      • lukeis
        :gist is preferred :)
      • selbot2_
        Please paste >3 lines of text to https://gist.github.com
      • rafajafar
      • oh well there's oldschool pastebin
      • lukeis
        ok, gimme a bit to look
      • philipp_k has quit
      • rafajafar
      • testingbot joined the channel
      • lukeis: I added comments, I really had to cut a lot away to show you the meat of it
      • line 48 is superfluous now, I just noticed. No big deal
      • lukeis
        any url example I can try?
      • rafajafar
        opps no it's not, nevermind
      • nah this isnt on a server
      • lukeis
        html copy i can try locally then?
      • rafajafar
        oh do you mean intercepted URL? you can try hmmm ... doesnt matter really, but http://cakewrecks.blogspot.com is a good test
      • shit man you're literally seeing an iota of the code
      • lukeis
        so, i don't see a call to driver.get(
      • rafajafar
        it's in click()
      • lukeis
        i understand :)
      • rafajafar
        this is for a client too, so not like I can give out too much
      • click calls get, though
      • *sometimes* ... so what I'm doing is identifying the location of adverts on pages
      • testingbot has quit
      • lukeis
        ok, but the way it seems is that line 52 is reached before a 'get' is called? (i know you've redacted a bunch of codeā€¦ but hopefully there's some kind of call to driver.get)
      • rafajafar
        then I am spraying them with clicks so I can determine whether they navigate away. Then collect those urls, associated with the calling element, and determine if it's an advertisement. If it is, I capture the following user experience.
      • I can give you the whole file I guess. It's still a work in progress
      • here you go
      • so it's really in an experimental state... we're trying to figure out if it can even be done with available tools
      • lukeis
        hmm, ads on pages sometimes do weird things and cause pages to not fully load, which lends itself to getting into a hung state
      • rafajafar
        yeah so that's something I definitely will need to timeout for. Honestly I'm trying to get the url they link to at this point. The problem is... iframes, canvas ads, and click events
      • so I'm using javascript to prevent any page navigation, and fortunately that still triggers selenium's "get()" but the window.stop is premature and I can't seem to get the get() call from hanging
      • lukeis
        fyi this channel is logged, so if you really want to keep that gist secret, i suggest deleting :)
      • rafajafar
        its got 24 hours on it
      • Sudhansu joined the channel
      • ah no that was the pastebin, dang, no big deal I'll delete it
      • the second file I sent, line 272... I call a click through actions