Jump to content
  • 0

Selenium python proxy


BeHappy4Ever

Question

  • Answers 2
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

2 answers to this question

Recommended Posts

  • 0

So, I'm guessing you just need a simple bot to do some action with I assume seleium.webdriver through a proxy server, here's a simple example, all you gotta do is add to chromeOptions, the proxy address, ip_address:port, here's some code:

 

Prerequisites:

Keep in mind that the chromeDriver version has to be the same with ur chrome browser version, that is if you want to use chrome as ur browser.

 

 

from selenium import webdriver
from selenium.webdriver.common.by import By

chromeOptionsInstance = webdriver.ChromeOptions()

#Add ur proxy server id, port by
#Replace the string "YOUR_Ip_Address_Here" with ur proxyServer ip address between quotes like '127.0.0.1' in the below dictionary
#Replace the string "Your_Port_here" with ur proxy server port in the below dictionary
proxyServer = {'ip_Address':'YOUR_Ip_Address_Here',
               'port':'Your_Port_here'}

chromeOptionsInstance.add_argument(f'--proxy-server={proxyServer["ip_Address"]}:{proxyServer["port"]}')

#Create webdriver.Chrome instance, don't forget to add the absolute path to chromedriver.exe for this example
driver = webdriver.Chrome(executable_path=r"Ur_ChromeDriver_Absolute_Path\chromedriver.exe", chrome_options=chromeOptionsInstance)
driver.get('https://metin2.dev/board/topic/25185-selenium-python-proxy/#comment-134552')

#Click on Answer this question elem.
driver.find_element_by_xpath("//a[contains(text(),'Answer this question')]").click()

 

In regards of a discrete proxy server, I don't got any, but I suggest using an VPN, does the job, there are alot of these for free on the internet

Edited by MGA
Updated a missing request in the post with an answer
Link to comment
Share on other sites

  • 0
10 hours ago, MGA said:

So, I'm guessing you just need a simple bot to do some action with I assume seleium.webdriver through a proxy server, here's a simple example, all you gotta do is add to chromeOptions, the proxy address, ip_address:port, here's some code:

 

Prerequisites:

Keep in mind that the chromeDriver version has to be the same with ur chrome browser version, that is if you want to use chrome as ur browser.

 

 

from selenium import webdriver
from selenium.webdriver.common.by import By

chromeOptionsInstance = webdriver.ChromeOptions()

#Add ur proxy server id, port by
#Replace the string "YOUR_Ip_Address_Here" with ur proxyServer ip address between quotes like '127.0.0.1' in the below dictionary
#Replace the string "Your_Port_here" with ur proxy server port in the below dictionary
proxyServer = {'ip_Address':'YOUR_Ip_Address_Here',
               'port':'Your_Port_here'}

chromeOptionsInstance.add_argument(f'--proxy-server={proxyServer["ip_Address"]}:{proxyServer["port"]}')

#Create webdriver.Chrome instance, don't forget to add the absolute path to chromedriver.exe for this example
driver = webdriver.Chrome(executable_path=r"Ur_ChromeDriver_Absolute_Path\chromedriver.exe", chrome_options=chromeOptionsInstance)
driver.get('https://metin2.dev/board/topic/25185-selenium-python-proxy/#comment-134552')

#Click on Answer this question elem.
driver.find_element_by_xpath("//a[contains(text(),'Answer this question')]").click()

 

In regards of a discrete proxy server, I don't got any, but I suggest using an VPN, does the job, there are alot of these for free on the internet

Thanks a lot brother for your answer.Wish you the best :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Activity

    1. 5
    2. 5

      Zodiac Roulette (Aeldra event concept)

    3. 0

      I am looking for a team for PVP Server!

    4. 0

      How about get quest flag from binary??

    5. 5

      Zodiac Roulette (Aeldra event concept)

    6. 5

      Zodiac Roulette (Aeldra event concept)

    7. 5

      Zodiac Roulette (Aeldra event concept)

    8. 12

      REAL_TIME_FIRST_USE items not being expired in the safe-box

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.