Best Python code snippet using lisa_python
main.py
Source:main.py
1from selenium import webdriver2from webdriver_manager.chrome import ChromeDriverManager3from webdriver_manager.firefox import GeckoDriverManager4from selenium.webdriver.common.by import By5driver = webdriver.Chrome(executable_path=ChromeDriverManager().install())6gettertool = "https://www.gettertools.com/nys.x1.asia.travian.com/42-Search-inactives#result"7driver.get(gettertool)8# Accept cookies9cookies = driver.find_element(By.CSS_SELECTOR, 'body > div > form > div > div > div.consentBoxBottom > '10 'div.consentBoxButtons > '11 'button.stylebutton.-accept-all.-button-main.-button-highlight')12cookies.click()13# left and right coor from getter site (for inactive players)14left_coord = driver.find_elements(By.CLASS_NAME, 'koordk1 > span')15right_coord = driver.find_elements(By.CLASS_NAME, 'koordk2 > span')16# Izbaciti iz liste sve leve koordinate17koordsLeva = []18koordsDesna = []19# lists with x and y coordinates20for k in left_coord:21 tmp = k.text22 koordsLeva.append([tmp])23for k in right_coord:24 tmp = k.text25 koordsDesna.append([tmp])26cpt1 = 027cpt2 = 028newList = []29while cpt1 < len(koordsLeva):30 newList.append(koordsLeva[cpt1] + koordsDesna[cpt2])31 cpt1 = cpt1 + 132 cpt2 = cpt2 + 133# change to new url34driver.get("https://nys.x1.asia.travian.com/")35# opening new raid list36create_raid = driver.find_element(By.XPATH, '//*[@id="raidList"]/div[3]/div[1]/a[2]/div/span')37create_raid.click()38# REP This action from here39# add village target40targets = driver.find_element(By.XPATH, '//*[@id="raidList903"]/div[2]/form/table/tfoot/tr[1]/td/a').click()41# left and rigth village coordinate target42left_target = driver.find_element(By.XPATH, '//*[@id="xCoordInput"]')43right_target = driver.find_element(By.XPATH, '//*[@id="yCoordInput"]')44# two dimensional array - coodrinates injection45cpt_injection = 046for i in newList:...
iDrac_Raids.py
Source:iDrac_Raids.py
1from .iDrac_Configuration import iDracObjectSummon2from .iDrac_Configuration import ping3import asyncio4def create_Raid(idracs):5 # Raid sections6 pingable_iDracs = []7 for iDrac in idracs:8 if ping(iDrac.ip):9 pingable_iDracs.append(iDrac)10 # Run all raids creation in async mode11 asyncio.run(iDracObjectSummon(pingable_iDracs))12def do_raids(idracs):...
__init__.py
Source:__init__.py
1from .create_raid import create_raid...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!