Esempio n. 1
0
def run():
    br = Browser(browser='chrome')

    br.goto("https://watir.com")

    # Check that "Titus" is somewhere in the page text
    assert "Watir" in br.text

    # Check "open source" is in the intro
    intro_text = br.div(class_name='intro').text
    assert "open source" in intro_text

    # Check that the page is correct via the URL
    br.link(text='Guides').click()
    assert 'watir.com/guides/' in br.url

    br.close()
Esempio n. 2
0
"""Basic script showing how Nerodia works."""
from nerodia.browser import Browser

br = Browser(browser='firefox')

br.goto("https://watir.com")

# Check that "Titus" is somewhere in the page text
assert "Watir" in br.text

# Check "open source" is in the intro
intro_text = br.div(class_name='intro').text
assert "open source" in intro_text

# Check that the page is correct via the URL
br.link(text='Guides').click()
assert 'watir.com/guides/' in br.url

br.close()
Esempio n. 3
0
# Based on http://watir.com/guides/form-example/

from nerodia.browser import Browser
from time import sleep  # needed to perform sleep
from faker import Faker  # needed for fake form data
import os  # needed for file path

# Setup
browser = Browser(browser='chrome')
browser.window().maximize()

# Navigate to the Page
browser.goto('a.testaddressbook.com')

# Authenticate and Navigate to the Form
browser.link(id='sign-in').click()
browser.text_field(data_test='email').set('*****@*****.**')
browser.text_field(data_test='password').set('password')
browser.button(name='commit').click()
browser.link(data_test='addresses').click()
browser.link(data_test='create').click()

# This uses the Faker Library to give us Random Data.
# Read more about Faker Library here: https://pypi.org/project/Faker/

fake = Faker()  # So we can use fake.name() instead of Faker().name()
browser.text_field(id='address_first_name').set(fake.first_name())
browser.text_field(id='address_last_name').set(fake.last_name())
browser.text_field(id='address_street_address').set(fake.street_address())
browser.text_field(id='address_secondary_address').set(
    fake.secondary_address())
Esempio n. 4
0
from nerodia.browser import Browser

browser = Browser(browser='firefox')
browser.goto("http://toolsqa.com/automation-practice-form/")
print(browser.title)

browser.link(text="Test File to Download").click()

browser.close()
Esempio n. 5
0
    r'([uU]ser\s[iI][dD]=[\S]+;|[pP]assword=[\S]+;|[dD]atabase=[\w0-9\-]+;|[sS]erver=[\w0-9\-\\]+;)+'
)

table = browser.table(id='projects-table')
print(f'Number of Projects = {sum(1 for e in table)-1}')
bad_strings = [
    'Description', 'AutomationCoreCode', '-old', "-OLD", 'APIGEE', 'Boomtown',
    'CARD_API', 'CoreDataServices', 'CoreProcesses', 'Core_project',
    'Databases', 'DevOps', 'EnterpriseACH', 'GatewayProcesses',
    'GatewayProject', 'Geti', 'Jmeter Load Testing', 'MVR',
    'MyOnlineReports Automation', 'PayaExchange', 'PayaExchange_Projects',
    'SED', ''
]
for row in table:
    if row[0].text != 'UNO':
        continue
    else:
        print(f'Checking project {row[0].text}')
        row[0].click()
        repos = browser.table(id='repositories-table')
        print(f'Number of Repos = {sum(1 for e in repos) - 1}')
        for repo in repos:
            if 'Repository' not in repo.text:
                continue
            else:
                print(f'Checking Repo {repo.text.replace("Repository", "")}')
                browser.link(text=repo.text.replace('Repository', '')).click()
                file_recursion()
            browser.back()
        browser.back()
Esempio n. 6
0
def main():

    global browserTwitter, browserNewEgg, username, password, driver, options, rtxCardLink

    options.add_argument("--log-level=3")

    time.sleep(2)

    print("...")

    time.sleep(3)

    #start up text
    clear_console(5)
    print("Welcome to the RTX Bot Script!")
    clear_console(1)
    print("To begin, enter your username and password")
    print("to access your personal information")
    clear_console(5)

    #logs user in to retrieve personal information
    login()

    time.sleep(2)

    print("...")

    time.sleep(3)

    print("User successfully logged in!")

    #loads personal infrormation using password as key for decryption
    loadPersonalInformation()

    time.sleep(2)
    print("...")
    time.sleep(1)
    print("Personal Information Loaded!")

    time.sleep(2)

    print("...")

    time.sleep(3)

    print("Loading vpn...")
    '''
    vpnStart()

    time.sleep(12)
    '''

    print("Connected to VPN!")

    print("...")

    time.sleep(3)

    print("Loading browser to newegg...")

    time.sleep(2)

    driver = webdriver.Chrome(options=options)
    browserNewEgg = Browser(browser=driver)

    time.sleep(4)

    browserNewEgg.goto(rtxCardLink)

    wait(1)

    #clears browser cache
    browserNewEgg.cookies.clear()

    wait(9)

    #closes pop up
    if (browserNewEgg.link(id='popup-close').exists):
        browserNewEgg.link(id='popup-close').click()

    print("All set! Refreshing newegg until they restock")

    x = datetime.datetime.now()
    y = x + datetime.timedelta(seconds=120)

    #checks newegg until restock
    restocked = False
    count = 0
    while restocked == False:

        if (count > 40):
            count = 0

            time.sleep(1)

            print("Restarting browser with new IP...")

            #clears browser cache
            browserNewEgg.cookies.clear()

            time.sleep(1)

            #closes browser
            browserNewEgg.close()

            time.sleep(1)

            #disconnect from vpn
            vpnEnd()

            time.sleep(10)

            #reconnects to vpn
            vpnStart()

            time.sleep(12)

            driver = webdriver.Chrome(options=options)
            browserNewEgg = Browser(browser=driver)
            time.sleep(1)
            browserNewEgg.goto(rtxCardLink)

            time.sleep(12)

            #closes pop up
            if (browserNewEgg.link(id='popup-close').exists):
                browserNewEgg.link(id='popup-close').click()

            wait(2)

        else:
            pass

        browserNewEgg.refresh()
        wait(3)

        locator = {"class": "nav-col", "index": 1}
        condition = (browserNewEgg.div(class_name="product-buy").div().div(
            **locator).button()).exists

        x = datetime.datetime.now()
        condition = x > y

        if (condition):
            restocked = True
        else:
            pass

        count += 1

    clear_console(100)

    print("Cards restocked!")

    time.sleep(1)

    #clicks add to cart
    browserNewEgg.div(class_name="product-buy").div().div(
        **locator).button().click()

    time.sleep(2)

    #declines warrenty if it is presented
    if (not (browserNewEgg.div(class_name="item-summary").exists)):
        locator = {"index": 0}
        browserNewEgg.div(class_name="modal-footer").button(**locator).click()

    time.sleep(2)

    #clicks view cart and checkout
    browserNewEgg.button(title="View Cart & Checkout").click()

    wait(5)

    #says no to masks if asked
    if (browserNewEgg.button(id="Masks_addtocart").exists):
        locator = {"index": 0}
        locator2 = {"index": 1}
        browserNewEgg.div(class_name="modal-footer").div(**locator2).button(
            **locator).click()

    time.sleep(2)

    #goes to secure checkout
    browserNewEgg.div(class_name="summary-actions").button().click()
Esempio n. 7
0
text1 = browser.element(class_name="h1-size")
print(text1)

text2 = browser.element(
    css=
    "#content > div.vc_row.wpb_row.vc_row-fluid.dt-default > div > div > div > div.vc_message_box.vc_message_box-standard.vc_message_box-rounded.vc_color-info > p:nth-child(2) > em > strong"
)
print(text2)

text3 = browser.element(
    text=
    "Always click on the ads display at the right side, this is how we manage the website’s expenses and bring free content for the beginners."
)
print(text3.text)

browser.link(text="Partial Link Test").wait_until_present().click()
browser.link(text="Link Test").wait_until_present().click()
browser.back()

browser.text_field(name="firstname").wait_until_present().set("Fname")
browser.text_field(name="firstname").clear()
browser.select_list(id="continents").select("Antartica")
browser.select_list(id="selenium_commands").select("Switch Commands")
browser.button(id="submit")

browser.radio(id="sex-0").set()
browser.radio(id="sex-1").set()
browser.radio(id="exp-2").set()
browser.text_field(id="datepicker").set("mmddyy")
browser.checkbox(value="Automation Tester").set()
browser.checkbox(id="profession-0").set()