def lambda_handler(event, context): driver = WebDriverWrapper() driver.get_url('http://35.236.100.236:8080') number = int(random.random()*100)%4 if number == 0: driver.click("//span[@data-customer='123']") elif number == 1: driver.click("//span[@data-customer='392']") elif number == 2: driver.click("//span[@data-customer='731']") else: driver.click("//span[@data-customer='567']") print("--------------------------") print("Success") print("--------------------------") time.sleep(1) driver.close() return { 'statusCode': 200, 'body': json.dumps({'message': 'Success - Clicked HotRod link'+' '+str(number)}) }
def lambda_handler(*args, **kwargs): driver = WebDriverWrapper() receiptnumber = os.getenv("RECEIPTNUMBER") driver.get_url('https://egov.uscis.gov/casestatus/landing.do') driver.set_input_value( '/html/body/div[2]/form/div/div[1]/div/div[1]/fieldset/div[1]/div[4]/input', receiptnumber) driver.click( '/html/body/div[2]/form/div/div[1]/div/div[1]/fieldset/div[2]/div[2]/input' ) example_text = driver.get_inner_html('(//div//h1)[1]') driver.close() return example_text
def lambda_handler(*args, **kwargs): driver = WebDriverWrapper() driver.get_url('https://www.google.es/') driver.set_input_value('//input[@name="q"]', '21 buttons') button = driver.find("(//input[@name='btnK'])[2]") button.send_keys(Keys.TAB) driver.click('//input[@name="btnK"]') first_google_result_title = driver.get_inner_html( '(//div[@class="rc"]//a)[1]') print("--------------------------") print(first_google_result_title) print("--------------------------") driver.close()
def lambda_handler(*args, **kwargs): driver = WebDriverWrapper() driver.get_url('https://www.google.es/') driver.set_input_value('//input[@id="lst-ib"]', '21 buttons') driver.click('//center//img[@alt="Google"]') time.sleep(0.5) driver.click('//input[@name="btnK"]') time.sleep(0.5) first_google_result_title = driver.get_inner_html( '(//div[@class="rc"]//a)[1]') print("--------------------------") print(first_google_result_title) print("--------------------------") driver.close()