Maitre2B: yes, if you're here to talk about selenium
CTtpollard joined the channel
Maitre2B
Whououh !
I'm a beginner with Selenium & java, i'm trying to create a bot to test a feature on my website
But i need the bot to change adresse IP every cycle
didn't find any method to change IP adress
i need to get a different ip adress everytime the bot connects on my website
oida has quit
dude-x
huh...
perfectsine has quit
what OS?
Maitre2B
i'm on W7
Neo-- has quit
oida joined the channel
any idea ? :s
huggie
Maitre2B: Work out how you do that when you do it manually, recreate it as part of your test, ..., profit.
Maitre2B
i don't even know how to do it manually lol
i thought there will be a function / method to do that with Selenium
ipconfig /release then ipconfig /renew in cmd ?
CTtpollard has quit
CTtpollard joined the channel
Maitre2B has quit
auto_sam joined the channel
Maitre2B joined the channel
?
sgsabbage
Maitre2B: Do you mean you need the server that connects to the website to have a different IP address, yes?
Maitre2B
hum.. no :s
i have a bot than connects to my website. I want this bot to have a different IP Adress everytime he connects to my website, so i can see different sessions
perfectsine joined the channel
sgsabbage
right, so you want whatever machine is connecting to your website to have a different IP address
Maitre2B
yup
in this case, it's my program in java
sgsabbage
yes, but the program itself isn't the thing that handles the IP address
that's generally the operating system
Maitre2B
yes
So i need this program to change my operating system IP adress, right ?
sgsabbage
there's no specific Selenium thing to handle that, so you'll, yeah, need to find a way to interact with the networking stack to either change IP or request a new IP address from its DHCP server if it has one
Maitre2B
oh god, okay :/
sgsabbage
internal or external network?
titusfortner joined the channel
Maitre2B
what's the difference ? :x
eteixeira_ joined the channel
i guess internal as it's my box / internet
sgsabbage
is your website also on the same network, or are you connecting across the internet? Obivously if it's the latter you'll need to have more than one public IP address
Maitre2B
no it's not
sgsabbage
What's the use case, are you testing code that specifically requries different IPs connecting to it?
Maitre2B
This program should work with any URL adress i want
yes exactly
i want my program to change my IP Adress, and then go on the specified website
i guess i should use a different proxy for every single time i connect to the website, right ?
jimevans joined the channel
titusfortner has quit
joshin4colours joined the channel
nirvdrum joined the channel
titusfortner joined the channel
yenaemj joined the channel
smccarthy joined the channel
kggr has quit
titusfortner has quit
Maitre2B has quit
SitamJana1 has quit
rplevka has quit
Bootinbull joined the channel
Rollup joined the channel
simonstewart has quit
Rollup has quit
sorinb_ joined the channel
brma joined the channel
sorinb has quit
brma
Can someone explain to me (or point me to a doc/slides/ect) the difference between sending a synthetic event, such as mousedown, using webdriver vs using pure javascript injection [e.g. var event = new Event('mousedown'); document.querySelector('input#someid').dispatchEvent(event) ] ?
WhereIsMySpoon: I've ready that. My issue is that I see differences in my SUT when I inject the javascript myself, vs when I let webdriver create the synthetic events
I just want to understand why
michl68 has quit
dude-x
i remember once having a test pass because we used javascript to set the dropdown
problem with that was the dropdown was actually broken
so it was better to use actual webdriver (Even if synthetic) to set a dropdown
anu_c joined the channel
brma
dude-x: yes. Did you ever understand *why* that was the case?
dude-x
yes
WhereIsMySpoon
brma: that'd be specific to your use case and what you're operating on
i would imagine
brma
dude-x: please elaborate, this is similar to what I'm seeing
dude-x
setting a value is doing that exactly. I am saying "Be this value"
as opposed to "click here, then click there"
if the previous author used webdriver to set a dropdown, then it would fail because the option to select won't be there due to visibility, checks
Dave_B_
oops
brma
oh, gotcha. Ok my issue is that I see differences when I tell webdriver click here, click there vs doing the exact same clicks, just using javascript events directly
WhereIsMySpoon
brma: trying to rebuild your app logic using js events and dispatch is a really good waste of time
imo
why are you trying to use js events and not just using webdriver
brma
WhereIsMySpoon: fascinating
WhereIsMySpoon
is webdriver not working?
Dave_B_
got a url brma?
WhereIsMySpoon
brma: hang on, you're clicking an input box? you arent trying to attach a file are you?
brma
Unfortunately no. I'm doing some security work, so I can't rally get into specifics about the SUT. I'm not attaching a file no.
WhereIsMySpoon
okay
DocD2 joined the channel
brma: is there a reason why you are trying to use js events?
and not just use webdriver's clicks and carry on
brma
Well, this is more about understanding the difference between the two. Webdriver's clicks work fine, I am just trying to understand the difference. I can detect that there is a real difference between using a webdriver synthetic click and a javascript event injected click
WhereIsMySpoon
brma: the first thing to check is that if you are -actually- doing the same logical thing
brma
ok, tell me more :)
WhereIsMySpoon
there may be app-specific logic behind mouseover or mouseup/mousedown or mouseevent
Dave_B_
example: clicking at an element, a transparent element on top actually recieves the click
WhereIsMySpoon
or that ^
dude-x
assuming you're the same type of click as webdriver, the only difference between webdriver and JS is webdriver does check if the element you're clikcing is visible first, then it sends the click event.
WhereIsMySpoon
webdriver's click will do exactly what a user's click will do
your recreation of a click event may not
brma: have you tried document.querySelector("input#someid").click() ?
instead of your dispatchEvent thing
brma
dude-x: ok thanks. This is good info.
Dave_B_
Maybe worth mentioning that also what browser thus what driver you're using can make a difference
dude-x
another thing too to consider is that when webdriver retrieves an element it's stored in a cache, which represents a certain state of the DOM. if you just do a click event with no checks, then it may happen to soon.
eteixeira_ has quit
eteixeira joined the channel
brma
Thanks everyone. This is all good info. I'll do some more digging and additional research to get to the bottom of my issue.
WhereIsMySpoon
im still really not sure why you're doing these js events n the first place
seems like an xy problem to me
but -shrug-
brma
WhereIsMySpoon: I have my reasons :)
I'm doing both webdriver AND the js events. Same tests, different behavior from the SUT. That's why I'm asking all these questions