Browser automation allows you to automate tasks in VMLogin's browser configuration file. From creating simple automated scripts to complex web crawlers, you can search、collect and interact with web data.

VMLogin browser automation is based on Selenium WebDriver.

Normally, if you run Selenium code, you need to connect to the Chrome driver firstly and then set up the functions you need. You don’t need this step When using VMLogin with Selenium code. You will use the Remote Web Driver program to connect to the Vmlogin application or a browser configuration file through a local port, set up the required functions, and execute Selenium commands in a predefined browser configuration file.

Languages

The Selenium framework provides multiple languages that can be used together, so VMLogin automation can also run on multiple coding languages. But at present, we only provide technical support for Java and Python.

Using Selenium in Vmlogin

Define VMLogin port

You need to define the software port in advance to use Selenium automation. Here is how to define the port:

In "My Account", turn on the browser automation setting, and set the usable port in the listening port. The default value is 35000, You can also set an access password.

Then, you can connect to VMLogin through the defined port.

The interface can also pass in proxy server information. If the incoming proxy information will overwrite the proxy information in the configuration file, this overwriting is temporary and will not really modify the configuration file. It is only valid for the automation interface:

http://127.0.0.1:35000/api/v1/profile/start?automation=true&profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&proxytype=socks5&proxyserver=ip&proxyport=1080&proxyusername=&proxypassword=

There are three types of agents:

proxytype=socks5
proxytype=socks4
proxytype=http

The proxy username and password can be left blank.

Python Case:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import requests
mla_profile_id = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
mla_url = 'http://127.0.0.1:35000/api/v1/profile/start?automation=true&profileId='+mla_profile_id
resp = requests.get(mla_url)
json = resp.json()
print(json['value'])
chrome_options = Options()
chrome_options.add_experimental_option("debuggerAddress", json['value'][7:])
chrome_driver = r"chromedriver.exe"
#Find out the “chromedriver.exe” file on VMLogin installation path where you installed
#Copy the file of "chromedriver.exe" and Paste on Python catalog
driver = webdriver.Chrome(chrome_driver, chrome_options=chrome_options)
driver.get('https://www.baidu.com/')
executor_url = driver.command_executor._url
session_id = driver.session_id
print(executor_url)
print(session_id)
print('ok it is done')
mla_url_stop = 'http://127.0.0.1:35000/api/v1/profile/stop?profileId='+mla_profile_id
requests.get(mla_url_stop)
driver.quit()
Proxy Recommendations: Luminati   Oxylabs   Smartproxy   Proxys.io   Abm   IPidea  
Copyright © 2020 vmlogin.us All Rights Reserved.