007
Registered Member
- Dec 21, 2007
- 63
- 2
Hi, I newbie in python and trying to make a simple bot, using python with selenium webdriver and I want to open browser in mobile size,
but I stuck in coding, I can not make it work so far, I use Brave browser, windows 7 64, python 3.8, selenium-4.1.
using python selenium with Brave browser normal size, works fine, but this time I try to work with smaller size browser, and I can not make it work.
Grateful for correcting my code, When I run it, nothing happen, no error either, I get this: "exited with code=0 in 0.985 seconds "
here is my code:
Appreciate your help.
but I stuck in coding, I can not make it work so far, I use Brave browser, windows 7 64, python 3.8, selenium-4.1.
using python selenium with Brave browser normal size, works fine, but this time I try to work with smaller size browser, and I can not make it work.
Grateful for correcting my code, When I run it, nothing happen, no error either, I get this: "exited with code=0 in 0.985 seconds "
here is my code:
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
def Data():
options = Options()
options.binary_location = "C:\\Program Files (x86)\\BraveSoftware\\Brave-Browser\\Application\\brave.exe"
driver = webdriver.Chrome(chrome_options=Options, executable_path="C:\\_ChromeDriver-97.0.4692.71\\chromedriver.exe",)
mobile_emulation = {
"userAgent": "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/90.0.1025.166 Mobile Safari/535.19"}
options.add_experimental_option("mobileEmulation", mobile_emulation)
options.add_argument("--log-level=3")
Mybot = webdriver.Chrome(chrome_options=Options)
Mybot.set_window_size(500, 950)
Mybot.get('https://www.bing.com')
Appreciate your help.