Closed xtwxfxk closed 1 year ago
from selenium_profiles.webdriver import Chrome
from selenium_profiles.profiles import profiles
from selenium_driverless.webdriver import ChromeOptions
import time
profile = profiles.Windows() # or .Android
options = ChromeOptions()
driver = Chrome(profile=profile, options=options, driverless_options=True)
back = driver.current_window_handle
# get url
driver.get('https://365365824.com/#/IP/B16')
driver.switch_to.target(driver.targets[0]["targetId"])
time.sleep(5)
driver.switch_to.target(back)
driver.quit() # Execute on the End!
works for me @xtwxfxk please close this issue in case it gets resolved by that
@kaliiiiiiiiii can view data Unable to operate like click to place a bet
eles = driver.find_elements(by=By.XPATH, value='//div[contains(@class, "ovm-ParticipantOddsOnly")]')
eles[0].click() ### detected and auto logout
@kaliiiiiiiiii can view data Unable to operate like click to place a bet
eles = driver.find_elements(by=By.XPATH, value='//div[contains(@class, "ovm-ParticipantOddsOnly")]') eles[0].click() ### detected and auto logout
Yeah expected that. Ocurs because .click()
basically executes elem.click()
with javascript
awaiting implementation at https://github.com/kaliiiiiiiiii/Selenium-Driverless/issues/5
ok thank you
@xtwxfxk following script worked for me as a workaround for now:
from selenium_profiles.webdriver import Chrome
from selenium_profiles.profiles import profiles
from selenium_driverless.webdriver import ChromeOptions
from selenium_driverless.types.by import By
import time
profile = profiles.Windows() # or .Android
options = ChromeOptions()
driver = Chrome(profile=profile, options=options, driverless_options=True)
back = driver.current_window_handle
# get url
driver.get('https://365365824.com/#/IP/B16')
driver.switch_to.target(driver.targets[0]["targetId"])
time.sleep(5)
driver.switch_to.target(back)
eles = driver.find_elements(by=By.XPATH, value='//div[contains(@class, "ovm-ParticipantOddsOnly")]')
elem = eles[0]
script = """
// https://stackoverflow.com/a/38073679/20443541
function fireClick(node){
if (document.createEvent) {
var evt = document.createEvent('MouseEvents');
evt.initEvent('click', true, false);
node.dispatchEvent(evt);
} else if (document.createEventObject) {
node.fireEvent('onclick') ;
} else if (typeof node.onclick == 'function') {
node.onclick();
}
};
fireClick(arguments[0])
"""
driver.execute_script(script,elem)
Insights:
looks like bet365 detected bare elem.click()
calls.
also, they patch the elem.click.toString
function with
(){var f=c.lastIndexOf(this);if(f>=0){return d[f]}return b(this)}
@xtwxfxk following script worked for me as a workaround for now:
from selenium_profiles.webdriver import Chrome from selenium_profiles.profiles import profiles from selenium_driverless.webdriver import ChromeOptions from selenium_driverless.types.by import By import time profile = profiles.Windows() # or .Android options = ChromeOptions() driver = Chrome(profile=profile, options=options, driverless_options=True) back = driver.current_window_handle # get url driver.get('https://365365824.com/#/IP/B16') driver.switch_to.target(driver.targets[0]["targetId"]) time.sleep(5) driver.switch_to.target(back) eles = driver.find_elements(by=By.XPATH, value='//div[contains(@class, "ovm-ParticipantOddsOnly")]') elem = eles[0] script = """ // https://stackoverflow.com/a/38073679/20443541 function fireClick(node){ if (document.createEvent) { var evt = document.createEvent('MouseEvents'); evt.initEvent('click', true, false); node.dispatchEvent(evt); } else if (document.createEventObject) { node.fireEvent('onclick') ; } else if (typeof node.onclick == 'function') { node.onclick(); } }; fireClick(arguments[0]) """ driver.execute_script(script,elem)
Insights: looks like bet365 detected bare
elem.click()
calls.also, they patch the
elem.click.toString
function with(){var f=c.lastIndexOf(this);if(f>=0){return d[f]}return b(this)}
not use for me, still get error and auto logout
@xtwxfxk
Perhaps using ActionChains
can succeed
do you use telegram?
Perhaps using
ActionChains
can succeed
uh yeah possibly, but the question is still how to implement it.
I could use:
Input
domaindo you use telegram?
@xtwxfxk nah, but Discord (steve_abcdef
username)
@xtwxfxk dumped some stuff at https://github.com/kaliiiiiiiiii/Selenium-Profiles/tree/dev/dev_stuff/bet365.com_analysis
feel free to tell if you see anything interesting//relevant about that stuff and detection
@xtwxfxk dumped some stuff at https://github.com/kaliiiiiiiiii/Selenium-Profiles/tree/dev/dev_stuff/bet365.com_analysis
feel free to tell if you see anything interesting//relevant about that stuff and detection
thanks
UPDATE: @xtwxfxk now bypassed without switch_to workarounds see https://github.com/kaliiiiiiiiii/Selenium-Driverless/discussions/18
./scripts/options.py can add default "user_data_dir" parameter to define custome profile dir?