コード例 #1
0
def mls_fantasy_login(
        login_id: str,
        password: str,
        mls_fantasy_url: str = "https://fantasy.mlssoccer.com/#") -> Chrome:
    '''
    Will log into the MLS fantasy page with login_id and password inputted from the user.
    Returns a Chrome webdriver which can be used to logout.
    '''

    # open a chrome browser and go to the mls fantasy landing page
    driver = Chrome()
    driver.get(mls_fantasy_url)
    driver.find_element_by_link_text('LOG IN').click()
    # send in login id and password and go into the browser
    time.sleep(3)
    username = driver.find_element_by_name('username')
    username.clear()
    username.send_keys(login_id)
    time.sleep(3)
    passcode = driver.find_element_by_name('password')
    passcode.clear()
    passcode.send_keys(password)

    driver.find_element_by_class_name('gigya-input-submit').click()
    time.sleep(3)
    driver.find_element_by_link_text('STATS CENTER').click()

    return driver
コード例 #2
0
def test_imdb_halloween():
    driver = Chrome(
        "/Users/andymckerrow/Helio/QAPoint/Python-Selenium-UI-Tests/_drivers/chromedriver"
    )
    driver.get("https://www.imdb.com/")
    driver.find_element_by_link_text('Halloween').click()
    assert driver.title == 'Halloween (2018) - IMDb'
コード例 #3
0
def play():
    # 画面上部「自動テストソフトソフトウェアによって制御されています」の表示を消す
    options = ChromeOptions()
    options.add_experimental_option(
        "excludeSwitches",
        ['enable-automation'])  # ['disable-automation']にすると戻る

    # 拡張機能のCRXパス、ChromeDriverの絶対パスを指定しChromeを起動
    options.add_extension('ChromeExtensions/2.0.0_0.crx')
    driver = Chrome('YOUR LOCATION', options=options)

    # ウィンドウを開く
    driver.maximize_window()
    driver.get(url)

    # 再生ページへ遷移
    time.sleep(1)
    driver.find_element_by_link_text("すべて再生").click()

    # 全画面表示
    time.sleep(1)
    pyautogui.press('f')

    # 起動時間を指定(秒)
    time.sleep(2350)

    # セッション終了
    driver.close()
コード例 #4
0
def get_player_ids_dictform(web_driver: Chrome) -> Dict[str, List[str]]:
    '''
    Create a dictionary with the player's MLS Fantasy soccer id as a key in
    a dictionary, and then a list of strings of the player's name and team as 
    the value.

    The web_driver must be one that is logged into the MLS site, else the stat
     center can't be accessed.
    '''
    player_ids = {}

    web_driver.find_element_by_link_text('STATS CENTER').click()
    time.sleep(2)

    select_team = Select(web_driver.find_element_by_id('js-filter-squads'))
    select_team.select_by_visible_text(TEAMS[1])

    for team in range(1, 27):
        select_team.select_by_visible_text(TEAMS[team])

        html = web_driver.page_source
        soup = BeautifulSoup(html, 'html.parser')

        for tag in soup.select('a.player-name.js-player-modal'):
            player_ids[tag['data-player_id']] = \
                [' '.join(tag.text.strip('\n').split()[:-6]), TEAMS[team]]

    return player_ids
コード例 #5
0
class Test_homePage01(unittest.TestCase):
    def setUp(self):
        self.browser=Chrome("C://Users/Debasis/PycharmProjects/ApiSampleProject/browser_server/chromedriver.exe")
        self.browser.implicitly_wait(20)
        self.browser.maximize_window()
        self.browser.get("https://opensource-demo.orangehrmlive.com/index.php/auth/validateCredentials")
        self.home_page=HomePage(self.browser)
    def tearDown(self):
        self.browser.get_screenshot_as_file("C:/Users/Debasis/PycharmProjects/ApiSampleProject/errorScreenshot"+self._testMethodName+"."+"png")
        self.browser.close()

    def test_homePage_valid_tc01(self):

        # self.home_page.wait_for_loginPage()
        self.home_page.get_user_name().send_keys("Admin")
        self.home_page.get_user_passwor().send_keys("admin123")
        self.home_page.get_user_loginButton().click()
        self.assertTrue(self.browser.title,'OrangeHRM')
    def test_homePage_logout(self):
        try:
            # self.home_page.wait_for_loginPage()
            self.home_page.get_user_name().send_keys("Admin")
            self.home_page.get_user_passwor().send_keys("admin123")
            self.home_page.get_user_loginButton().click()
            self.assertTrue(self.browser.title, 'OrangeHRM')
            self.browser.find_element_by_id("welcome").click
            self.browser.find_element_by_link_text("Logout").click()
            self.browser.get_screenshot_as_file("C:/Users/Debasis/PycharmProjects/ApiSampleProject/errorScreenshot/logOut.png")
            print("Logout Successful")
        except NoSuchElementException as e:
            print(e)
コード例 #6
0
 def t4_verify_drag_drop(self):
     '''
             function to verify the 'Drag and Drop'
             :return: Returns boolean value
             '''
     try:
         browser = Chrome(self.chrome_path)
         ins_obj = inspect.currentframe()
         func_name = inspect.getframeinfo(ins_obj).function
         print(func_name)
         ss_file = RESULT + "\\" + func_name + "_" + str(
             time.time()).split('.')[0] + ".png"
         browser.get(self.home_page)
         browser.find_element_by_link_text("Drag and Drop").click()
         source1 = browser.find_element_by_xpath('//*[@id ="column-a"]')
         target1 = browser.find_element_by_xpath('//*[@id ="column-b"]')
         action = ActionChains(browser)
         action.drag_and_drop(source1, target1).perform()
         self.drag_and_drop(browser, source1, target1)
         browser.save_screenshot(ss_file)
         self.logger.info("Drag and Drop verified successfully")
         browser.close()
         return True
     except Exception as err:
         self.logger.error(err)
         return False
コード例 #7
0
def test_imdb_navtobadlands():
    driver = Chrome(
        "/Users/andymckerrow/Helio/QAPoint/Python-Selenium-UI-Tests/_drivers/chromedriver"
    )
    driver.get("https://www.imdb.com/")
    driver.find_element_by_id('navbar-query').send_keys('badlands')
    driver.find_element_by_css_selector('[class*="magnifyingglass"]').click()
    driver.find_element_by_link_text('Badlands').click()
    assert driver.title == 'Badlands (1973) - IMDb'
コード例 #8
0
 def __init__(self, gym, login, password):
     Chrome.__init__(self, self.executable_path, options=self.options)
     Chrome.implicitly_wait(self, self.time_to_wait)
     Chrome.get(self, self.ff_website)
     Chrome.find_element_by_css_selector(
         self, self.gym_selector).click()  # Expand gym location dropdown
     Chrome.find_element_by_link_text(self, gym).click()  # Choose gym
     Chrome.find_element_by_id(self, 'requiredtxtUserName').send_keys(login)
     Chrome.find_element_by_id(self,
                               'requiredtxtPassword').send_keys(password)
     Chrome.find_element_by_id(self, 'btnLogin').click()  # Login
コード例 #9
0
def test_imdb_badlandsreleasedate():
    driver = Chrome(
        "/Users/andymckerrow/Helio/QAPoint/Python-Selenium-UI-Tests/_drivers/chromedriver"
    )
    driver.get("https://www.imdb.com/")
    driver.find_element_by_id('navbar-query').send_keys('badlands')
    driver.find_element_by_css_selector('[class*="magnifyingglass"]').click()
    driver.find_element_by_link_text('Badlands').click()
    assert 'Badlands (1973) - IMDb' + '1973'
    assert 'Badlands (1973) - IMDB' + 'PG'
    assert 'Badlands (1973) - IMDB' + '1hr 34min'
    assert 'Badlands (1973) - IMDB' + 'Crime'
    assert 'Badlands (1973) - IMDB' + 'Drama'
    assert 'Badlands (1973) - IMDB' + 'Terrence Malick'
コード例 #10
0
class Twitter:

    def __init__(self, username, password):
        self.username = username
        self.password = password
        self.driver = Chrome(PATH)

    def get_driver(self):
        """
        Returns the Driver used for the Scraping
        """
        return self.driver

    def set_driver(self, driver):
        if driver == 'chrome':
            self.driver = Chrome(PATH)
        elif driver == "edge":
            print('Sorry, this feature hasnt yet been implemented.')
        elif driver == "firefox":
            print('Sorry, this feature hasnt yet been implemented.')
        else:
            print('Sorry, I dont know this browser.')

    def login(self):
        # navigate to twitter login page using 'get' module
        self.driver.get('https://twitter.com/login/')
        sleep(2)

        # enter the username and password
        username = self.driver.find_element_by_xpath(
            '//input[@name="session[username_or_email]"]')
        username.send_keys(self.username)
        password = self.driver.find_element_by_xpath(
            '//input[@name="session[password]"]')  # enter the password
        password.send_keys(self.password)
        # login using the login button (similar action than to just press enter)
        password.send_keys(Keys.RETURN)
        sleep(2)

    def search(self, searchterm):
        # enter the searchterm
        search_input = self.driver.find_element_by_xpath(
            '//input[@aria-label="Search query"]')
        search_input.send_keys(searchterm)
        search_input.send_keys(Keys.RETURN)
        sleep(2)

        self.driver.find_element_by_link_text('Latest').click()
        sleep(1)
コード例 #11
0
def test_post_count_on_cypress_label():
    # Uruchomienie przeglądarki Chrome. Ścieżka do chromedrivera

    # ustawiana automatycznie przez bibliotekę webdriver-manager
    browser = Chrome(executable_path=ChromeDriverManager().install())

    # Otwarcie strony
    browser.get('https://www.awesome-testing.com/')

    # Inicjalizacja elementu z labelką
    category = browser.find_element_by_link_text('Cypress')

    # Kliknięcie na labelkę
    category.click()

    # Czekanie na stronę
    time.sleep(5)

    # Pobranie listy tytułów
    list_of_entries = browser.find_elements(By.CSS_SELECTOR, '.post-title a')

    # Asercja że lista ma 1 element
    assert len(list_of_entries) == 1

    # Zamknięcie przeglądarki
    browser.quit()
コード例 #12
0
def test_post_count_on_cypress_label():
    # Uruchomienie przeglądarki Chrome. Ścieżka do chromedrivera

    # ustawiana automatycznie przez bibliotekę webdriver-manager
    browser = Chrome(executable_path=ChromeDriverManager().install())

    # Otwarcie strony
    browser.get('https://www.awesome-testing.com/')

    # Inicjalizacja elementu z labelką
    category = browser.find_element_by_link_text('Cypress')

    # Kliknięcie na labelkę
    category.click()

    # Czekanie na stronę
    wait=WebDriverWait(browser,10)
    grey_status_bar=(By.CLASS_NAME,'status-msg-body')
    wait.until(expected_conditions.visibility_of_element_located(grey_status_bar))

    # Pobranie listy tytułów
    list_of_entries = browser.find_elements(By.CSS_SELECTOR, '.post-title a')

    # Asercja że lista ma 1 element
    assert len(list_of_entries) == 1

    # Zamknięcie przeglądarki
    browser.quit()
コード例 #13
0
def check_state(state):
    chrome_options = Options()
    chrome_options.headless = True
    driver = Chrome(options=chrome_options)

    driver.get('https://www.cvs.com/immunizations/covid-19-vaccine')
    driver.find_element_by_link_text(state).click()

    soup = BeautifulSoup(driver.page_source, 'html.parser')
    driver.quit()

    columns = []
    data = []
    for table in soup.find_all('table'):
        columns = [th.text for th in table.thead.find_all('th')]
        for tr in table.tbody.find_all('tr'):
            data.append([td.text for td in tr.find_all('td')])

    status_df = pd.DataFrame(data, columns=columns)
    avail_cities = status_df[status_df[columns[-1]] != 'Fully Booked']
    return avail_cities, status_df
コード例 #14
0
def emulate_articles_view(driver: webdriver.Chrome, host, username, password):
    try:
        sign_in_with_driver(driver, host, username, password)
        driver.get(MY_SUGGESTIONS.format(host=host, port=PORT))
        source = driver.page_source
        for article_id in re.findall(ARTICLE_BTN_TEMPLATE, source):
            driver.get(
                GET_ARTICLE_URL.format(host=host,
                                       port=PORT,
                                       article_id=article_id))
            for href in re.findall(TABLE_OF_CONTENTS_PATTERN,
                                   driver.page_source):
                link_el = driver.find_element_by_link_text(href)
                link_el.click()
    except NoSuchElementException as e:
        raise ApiException(ExceptionType.MUMBLE, e)
コード例 #15
0
ファイル: push2kindle.py プロジェクト: COLD-PLAY/Others
def get_book(url, file):
    options = webdriver.ChromeOptions()
    prefs = {
        'profile.default_content_settings.popups':
        0,
        'download.default_directory':
        'C:/Users/liaoz/Desktop/GitHub/Others/Others/The Economist/'
    }
    options.add_experimental_option('prefs', prefs)

    # driver = PhantomJS()
    driver = Chrome(chrome_options=options)
    driver.get(url)

    link = driver.find_element_by_link_text(file)
    link_url = link.get_attribute("href")
    # print(link_url)
    driver.get(link_url)
    driver.find_element_by_id('free_down_link').click()

    time.sleep(100)
    driver.quit()
コード例 #16
0
def searchTweets(username, password, searchterm):

    driver = Chrome(ChromeDriverManager().install())
    driver.get('https://twitter.com/login')

    time.sleep(1)

    user = driver.find_element_by_xpath(
        "//input[@name='session[username_or_email]']")
    user.send_keys(username)

    passw = driver.find_element_by_xpath("//input[@name='session[password]']")
    passw.send_keys(password)
    passw.send_keys(Keys.RETURN)

    time.sleep(1)

    search_input = driver.find_element_by_xpath(
        "//input[@aria-label='Search query']")
    search_input.send_keys(searchterm)
    search_input.send_keys(Keys.RETURN)

    time.sleep(1)

    people = driver.find_element_by_link_text('People')
    people.click()

    time.sleep(1)

    driver.find_element_by_xpath(
        "//div[@class='css-1dbjc4n r-1awozwy r-18u37iz r-1wtj0ep']").click()

    time.sleep(1)

    tweet = driver.find_element_by_xpath(
        "//div[@class='css-901oao r-1fmj7o5 r-1qd0xha r-a023e6 r-16dba41 r-rjixqe r-bcqeeo r-bnwqim r-qvutc0']"
    )

    return tweet.text
コード例 #17
0
    '*****@*****.**')
driver.find_element_by_name('fld_password').send_keys('abcd123')
driver.find_element_by_name('fld_cpassword').send_keys('abcd123')
driver.find_element_by_name('fld_username').send_keys('abcd123')

# Working on radio button

driver.find_element_by_xpath("//input[@value='home']").click()

# work on dropdown

obj = Select(driver.find_element_by_name("sex"))
obj.select_by_visible_text('Male')
#obj.select_by_value('2')
#obj.select_by_index(1)

# Working on Checkbox

driver.find_element_by_name("terms").click()

# work on button

#driver.find_element_by_xpath("//input[@type = 'submit']")

# Work on links

driver.find_element_by_link_text("Read Detail").click()

# close Driver

# driver.close()
コード例 #18
0
logon = browser.find_element_by_css_selector('input.btn.btn-primary')
logon.click()

browser.get('https://eit1-i.svcs.hp.com/cds/LoadLdssAsync')

load_option = browser.find_element_by_id('UploadOptionList')
load_option.send_keys('Validate Only')

file_selector = browser.find_element_by_id('ldssfile')
file_selector.send_keys(r'C:\Users\tangjing\Desktop\Auto-Reg\Automation.xlsx')

upload = browser.find_element_by_css_selector('input[value="Upload"]')
upload.click()

console =  browser.find_element_by_link_text('CDS Console')
console.click()

submitter = browser.find_element_by_id('Filters_Submitter')
submitter.clear()

submitter = browser.find_element_by_id('Filters_Submitter')
submitter.send_keys(USER1)

show = browser.find_element_by_id('Filters_Timefilterval')
show.send_keys('Last 1 week')

Apply_Filter = browser.find_element_by_id('ApplyFilterButton')
Apply_Filter.click()

jobs = get_job(browser)
コード例 #19
0
ファイル: baidusearch.py プロジェクト: Crush317/spider
from selenium.webdriver import Chrome
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
import time
import os

browser = Chrome()
browser.get("https://www.baidu.com")
time.sleep(1)
browser.maximize_window()
time.sleep(2)
link = browser.find_element_by_xpath('//*[@id="s-usersetting-top"]')
ActionChains(browser).move_to_element(link).perform()
browser.find_element_by_link_text('搜索设置').click()
time.sleep(3)
browser.find_element_by_id('nr_3').click()
time.sleep(2)
browser.find_element_by_xpath('//*[@id="se-setting-7"]/a[2]').click()
time.sleep(2)
browser.switch_to_alert().accept()
time.sleep(1)
browser.find_element_by_id('kw').send_keys('selenium')
browser.find_element_by_id('su').submit()
time.sleep(2)
js = "var q=document.documentElement.scrollTop=10000"
browser.execute_script(js)
time.sleep(3)
js = "var q=document.documentElement.scrollTop=0"
browser.execute_script(js)
time.sleep(3)
browser.close()
コード例 #20
0
html_rental = html_rental[:16]
rental_fees = [float(x.replace(',', '').replace('$', '')) for x in html_rental]
rental_fees = rental_fees[:
                          -8]  # only want the one year and use to calculate each month
utilities_fees = np.array(rental_fees[-4:])
rental_fees = np.array(rental_fees[:4])
total_fees = utilities_fees + rental_fees
total_fees = (total_fees + key_deposit_fee +
              registration_fee) / 11  # to get per month
# print(total_fees)

# YO:HA HOSTEL @ PEARL'S HILL SMU
SMU_HOSTEL_URL = 'https://www.smu.edu.sg/campus-life/facilities-leasing/student-facilities/yo-ha-hostel-pearls-hill'
browser = Chrome(WEBDRIVER_PATH)
browser.get(SMU_HOSTEL_URL)
browser.find_element_by_link_text('Room Rates').click()
html = browser.page_source
df = pd.read_html(html)
df = df[0]
browser.quit()

accomodation_charges = np.array(
    [float(x.replace('$', '').replace(',', '')) for x in df[1][1:]])
utility_charges = np.array(
    [float(x.replace('$', '').replace(',', '')) for x in df[2][1:]])
admin_charges = np.array(
    [float(x.replace('$', '').replace(',', '')) for x in df[3][1:]])
charges = accomodation_charges + utility_charges + admin_charges

# Combine both hostel into one common array
total_fees = np.append(total_fees, charges)
コード例 #21
0
class TestSuite_Empirix(unittest.TestCase):
    def setUp(self):
        logging.info("(Chrome)## -- Entering 'setUp()' method -- ##")
        try:
            self.driver = Chrome(
                executable_path=
                r'E:\Pawan\Selenium\WebAppTests_Empirix\drivers\chromedriver.exe'
            )
            self.driver.implicitly_wait(30)
            self.driver.maximize_window()
            self.driver.get("https://services.empirix.com/")
        except Exception as e:
            logging.exception("(Chrome)Issue in func setUp() - " + str(e))
            logging.exception(traceback.format_exc())

    def waitByName(self, name):
        try:
            WebDriverWait(self.driver, 100).until(
                EC.presence_of_element_located((By.NAME, name)))
        except TimeoutError:
            logging.exception("(Chrome)Issue in func waitByName()")
            logging.exception(traceback.format_exc())

    def waitByClass(self, classname):
        try:
            WebDriverWait(self.driver, 100).until(
                EC.element_to_be_clickable((By.CLASS_NAME, classname)))
        except TimeoutError:
            logging.exception("(Chrome)Issue in func waitByName()")
            logging.exception(traceback.format_exc())

    def waitByXpath(self, xpath):
        try:
            WebDriverWait(self.driver, 100).until(
                EC.element_to_be_clickable((By.XPATH, xpath)))
        except TimeoutError:
            logging.exception("(Chrome)Issue in func waitByXpath()")
            logging.exception(traceback.format_exc())

    def slow_typing(self, element, text):
        try:
            for character in text:
                element.send_keys(character)
                time.sleep(0.3)
        except Exception as e:
            logging.exception("(Chrome)Issue in func slow_typing() - " +
                              str(e))
            logging.exception(traceback.format_exc())

    def check_exists(self):
        try:
            self.driver.find_element_by_class_name('product')
        except NoSuchElementException:
            return False
        return True

    def Empirix_Login(self):
        logging.info("(Chrome)## -- Entering 'Empirix_Login()' method -- ##")
        try:
            time.sleep(1)

            logging.info(
                "(Chrome)#--Located the 'username' textbox and going to slow-type username in it--"
            )
            self.waitByName('callback_0')
            username = self.driver.find_element_by_name('callback_0')
            self.slow_typing(username, 'QA_traininguser25')
            time.sleep(1)

            logging.info(
                "(Chrome)#--Located the 'password' textbox and going to enter password into it via a file saved in system--"
            )
            self.waitByName('callback_1')
            password = self.driver.find_element_by_name('callback_1')

            try:
                with open('password.txt', 'r') as myfile:
                    Password = myfile.read().replace('\n', '')
            except:
                Password = "******"

            self.slow_typing(password, Password)
            time.sleep(2)

            logging.info(
                "(Chrome)#--Located and going to click on the 'Sign-in' button--"
            )
            self.waitByName('callback_2')
            signin = self.driver.find_element_by_name('callback_2')
            signin.click()

            time.sleep(30)

            logging.info(
                "(Chrome)#--Located a Cookies popup on Window and going to press 'OK'--"
            )
            try:
                cookies = self.driver.find_element_by_class_name(
                    'cc-compliance')
                cookies.click()
                logging.info("(Chrome)Cookies popup clicked successfully..")
                time.sleep(2)
            except:
                logging.exception("(Chrome)Cookies popup not clicked..")

            logging.info("(Chrome)Login Successful in 'Empirix' Website..")
            time.sleep(30)

        except Exception as e:
            logging.exception("(Chrome)Issue in func Empirix_Login() - " +
                              str(e))
            logging.info(
                "(Chrome)TestCase:: Logged into the 'Empirix' Website Successfully : FAIL"
            )
            logging.exception(traceback.format_exc())

    #@unittest.skip("demonstrating skipping")
    def test_Empirix_Login(self):
        logging.info(
            "(Chrome)## -- Entering TestCase method 'test_Empirix_Login()' -- ##"
        )
        try:
            self.Empirix_Login()
            time.sleep(2)

            try:
                logging.info(
                    "(Chrome)#--Trying locating first page after Sign-in operation--"
                )
                res = self.check_exists()
                if res:
                    logging.info(
                        "(Chrome)TestCase:: Logged into the 'Empirix' Website Successfully : PASS"
                    )
            except:
                logging.exception(
                    "(Chrome)#--Trying locating 'Sign-in' button on the page even after login operation--"
                )
                signin = self.driver.find_element_by_name('callback_2')
                if signin:
                    logging.exception(
                        "(Chrome)TestCase:: Failed to login in 'Empirix' Website(Username / Password mismatch or some other issue) : FAIL"
                    )

        except Exception as e:
            logging.exception("(Chrome)Issue in func test_Empirix_Login() - " +
                              str(e))
            logging.info(
                "(Chrome)TestCase:: Logged into the 'Empirix' Website Successfully : FAIL"
            )
            logging.exception(traceback.format_exc())

    def switch_language_toEnglish(self):
        logging.info(
            "(Chrome)## -- Entering 'switch_language_toEnglish()' method -- ##"
        )
        try:
            logging.info("(Chrome)#--Going to click on Profile dropdown--")
            profile_dropdown = self.driver.find_element_by_link_text(
                'QA_traininguser25(Empirix_QA_Training)')
            profile_dropdown.click()
            time.sleep(3)

            logging.info(
                "(Chrome)#--Located and going to click on the 'English' button from dropdown--"
            )
            English = self.driver.find_element_by_xpath(
                "//a[text()='English']")
            English.click()
            logging.info("(Chrome)Clicked English button..")
            time.sleep(5)

            logging.info(
                "(Chrome)#--Switched to popup alert message to accept it--")
            obj = self.driver.switch_to.alert
            logging.info("(Chrome)Before clicking Alert")
            time.sleep(2)
            obj.accept()
            logging.info("(Chrome)After clicking Alert")
            time.sleep(30)
        except Exception as e:
            logging.exception(
                "(Chrome)Issue in func switch_language_toEnglish() - " +
                str(e))
            logging.exception(
                "(Chrome)TestCase:: Successfully switched to 'English' language(inside except) : FAIL"
            )
            logging.exception(traceback.format_exc())

    def switch_language_toJapanese(self):
        logging.info(
            "(Chrome)## -- Entering 'switch_language_toJapanese()' method -- ##"
        )
        try:
            logging.info("(Chrome)#--Going to click on Profile dropdown--")
            profile_dropdown = self.driver.find_element_by_link_text(
                'QA_traininguser25(Empirix_QA_Training)')
            profile_dropdown.click()
            time.sleep(3)

            logging.info(
                "(Chrome)#--Located and going to click on the 'Japanese' button from dropdown--"
            )
            Japan = self.driver.find_element_by_xpath("//a[text()='Japanese']")
            Japan.click()
            logging.info("(Chrome)Clicked Japanese..")
            time.sleep(5)

            logging.info(
                "(Chrome)#--Switched to popup alert message to accept it--")
            obj = self.driver.switch_to.alert
            logging.info("(Chrome)Before clicking Alert")
            time.sleep(2)
            obj.accept()
            logging.info("(Chrome)After clicking Alert")
            time.sleep(30)
        except Exception as e:
            logging.exception(
                "(Chrome)TestCase:: Successfully switched to 'Japanese' language(inside except) : FAIL"
            )
            logging.exception(
                "(Chrome)Issue in func switch_language_toEnglish() - " +
                str(e))
            logging.exception(traceback.format_exc())

    #@unittest.skip("Skipping English")
    def test_switch_language_toEnglish(self):
        logging.info(
            "(Chrome)## -- Entering TestCase method 'test_switch_language_toEnglish()' -- ##"
        )
        try:
            self.Empirix_Login()
            time.sleep(2)

            try:
                logging.info(
                    "(Chrome)#--Trying locating English 'Dashboard' tab on the page--"
                )
                dashboard_eng = self.driver.find_element_by_xpath(
                    "//a[text()='Dashboard']")
                if dashboard_eng:
                    logging.info(
                        "(Chrome)TestCase:: Successfully switched to 'English' language : PASS"
                    )
            except:
                # var = 'ダッシュボード'
                # var = ascii(var)
                # var = '\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9'
                logging.exception(
                    "(Chrome)#--Trying locating Japanese 'Dashboard' tab on the page(inside except)--"
                )
                dashboard_jap = self.driver.find_element_by_xpath(
                    "//a[text()='\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9']")
                if dashboard_jap:
                    logging.exception(
                        "(Chrome)Found Japanese, updating language to English")
                    self.switch_language_toEnglish()
                    try:
                        logging.exception(
                            "(Chrome)#-- Again trying locating English 'Dashboard' tab on the page--"
                        )
                        dashboard_eng = self.driver.find_element_by_xpath(
                            "//a[text()='Dashboard']")
                        if dashboard_eng:
                            logging.exception(
                                "(Chrome)TestCase:: Successfully switched to 'English' language : PASS"
                            )
                    except:
                        logging.exception(
                            "(Chrome)TestCase:: Successfully switched to 'English' language(language not changed or Page load issue) : FAIL"
                        )

        except Exception as e:
            logging.exception(
                "(Chrome)TestCase:: Successfully switched to 'English' language(inside except) : FAIL"
            )
            logging.exception("(Chrome)Issue in func switch_language() - " +
                              str(e))
            logging.exception(traceback.format_exc())

    #@unittest.skip("Skipping English")
    def test_switch_language_toJapanese(self):
        logging.info(
            "(Chrome)## -- Entering TestCase method 'test_switch_language_toJapanese()' -- ##"
        )
        try:
            self.Empirix_Login()
            time.sleep(2)

            try:
                # var = 'ダッシュボード'
                # var = ascii(var)
                # var = '\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9'
                logging.info(
                    "(Chrome)#--Trying locating Japanese 'Dashboard' tab on the page--"
                )
                dashboard_jap = self.driver.find_element_by_xpath(
                    "//a[text()='\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9']")
                if dashboard_jap:
                    logging.info(
                        "(Chrome)TestCase:: Successfully switched to 'Japanese' language : PASS"
                    )
            except:
                logging.exception(
                    "(Chrome)#--Trying locating English 'Dashboard' tab on the page(inside except)--"
                )
                dashboard_eng = self.driver.find_element_by_xpath(
                    "//a[text()='Dashboard']")
                if dashboard_eng:
                    logging.exception(
                        "(Chrome)Found English, updating language to Japanese")
                    self.switch_language_toJapanese()
                    try:
                        # var = 'ダッシュボード'
                        # var = ascii(var)
                        # var = '\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9'
                        logging.exception(
                            "(Chrome)#-- Again trying locating Japanese 'Dashboard' tab on the page--"
                        )
                        dashboard_jap = self.driver.find_element_by_xpath(
                            "//a[text()='\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9']"
                        )
                        if dashboard_jap:
                            logging.exception(
                                "(Chrome)TestCase:: Successfully switched to 'Japanese' language : PASS"
                            )
                    except:
                        logging.exception(
                            "(Chrome)TestCase:: Successfully switched to 'Japanese' language(language not changed or Page load issue) : FAIL"
                        )

        except Exception as e:
            logging.exception(
                "(Chrome)TestCase:: Successfully switched to 'Japanese' language(inside except) : FAIL"
            )
            logging.exception("(Chrome)Issue in func switch_language() - " +
                              str(e))
            logging.exception(traceback.format_exc())

    def viewTabs_English(self):
        logging.info(
            "(Chrome)## -- Entering 'viewTabs_English()' method -- ##")
        try:
            logging.info("(Chrome)#--Accessing English Dashboard Tab--")

            logging.info(
                "(Chrome)# --Located and going to click on the Dashboard tab--"
            )
            self.waitByXpath("//a[text()='Dashboard']")
            dashboard = self.driver.find_element_by_xpath(
                "//a[text()='Dashboard']")
            dashboard.click()
            time.sleep(10)

            logging.info(
                "(Chrome)# --Locating a heading 'Overall Performance' on the page before taking screenshot--"
            )
            if self.driver.find_element_by_xpath("//div[@class='col-md-3']"):
                self.driver.save_screenshot(image_path +
                                            "Dashboard_english_chrome.png")
                logging.info(
                    "(Chrome)English Dashboard accessed and captured an Image of it.."
                )

        except Exception as e:
            logging.exception(
                "(Chrome)Issue in func test_viewTabs_English(), inside Dashboard Tab - "
                + str(e))
            logging.exception(traceback.format_exc())

        try:
            logging.info("(Chrome)# --Accessing English Alerts Tab--")

            logging.info(
                "(Chrome)# --Located and going to click on the Alerts tab--")
            time.sleep(3)
            self.waitByXpath("//a[text()='Alerts']")
            alerts = self.driver.find_element_by_xpath("//a[text()='Alerts']")
            alerts.click()
            time.sleep(10)

            logging.info(
                "(Chrome)# --Locating a heading 'Alert Status' on the page before taking screenshot--"
            )
            if self.driver.find_element_by_xpath(
                    "//th[text()='Alert Status']"):
                self.driver.save_screenshot(image_path +
                                            "Alerts_english_chrome.png")
                logging.info(
                    "(Chrome)English Alerts accessed and captured an Image of it.."
                )

        except Exception as e:
            logging.exception(
                "(Chrome)Issue in func test_viewTabs_English(), inside Alerts Tab - "
                + str(e))
            logging.exception(traceback.format_exc())

        try:
            logging.info("(Chrome)# --Accessing English Tests Tab--")

            logging.info(
                "(Chrome)# --Located and going to click on the Tests tab--")
            time.sleep(3)
            self.waitByXpath("//a[text()='Tests']")
            tests = self.driver.find_element_by_xpath("//a[text()='Tests']")
            tests.click()
            time.sleep(10)

            logging.info(
                "(Chrome)# --Locating a heading 'Please select a test' on the page before taking screenshot--"
            )
            if self.driver.find_element_by_xpath(
                    "//span[text()='Please select a test']"):
                self.driver.save_screenshot(image_path +
                                            "Tests_english_chrome.png")
                logging.info(
                    "(Chrome)English Tests accessed and captured an Image of it.."
                )

        except Exception as e:
            logging.exception(
                "(Chrome)Issue in func test_viewTabs_English(), inside Tests Tab - "
                + str(e))
            logging.exception(traceback.format_exc())

        try:
            logging.info("(Chrome)# --Accessing English Variables Tab--")

            logging.info(
                "(Chrome)# --Located and going to click on the Variables tab--"
            )
            time.sleep(3)
            self.waitByXpath("//a[text()='Variables']")
            tests = self.driver.find_element_by_xpath(
                "//a[text()='Variables']")
            tests.click()
            time.sleep(10)

            logging.info(
                "(Chrome)# --Locating a heading 'Please select a variable, or the following:' on the page before taking screenshot--"
            )
            if self.driver.find_element_by_xpath(
                    "//div[text()=' Please select a variable, or the following:']"
            ):
                self.driver.save_screenshot(image_path +
                                            "Variables_english_chrome.png")
                logging.info(
                    "(Chrome)English Variables accessed and captured an Image of it.."
                )

        except Exception as e:
            logging.exception(
                "(Chrome)Issue in func test_viewTabs_English(), inside Variables Tab - "
                + str(e))
            logging.exception(traceback.format_exc())

        try:
            logging.info("(Chrome)# --Accessing English Notifications Tab--")

            logging.info(
                "(Chrome)# --Located and going to click on the Notifications tab--"
            )
            time.sleep(3)
            self.waitByXpath("//a[text()='Notifications']")
            notifications = self.driver.find_element_by_xpath(
                "//a[text()='Notifications']")
            notifications.click()
            time.sleep(10)

            logging.info(
                "(Chrome)# --Locating a heading 'Please select a notification' and clicked on 'test' before taking screenshot--"
            )
            if self.driver.find_element_by_xpath(
                    "//span[text()='Please select a notification']"):
                test = self.driver.find_element_by_class_name(
                    "nav.nav-sidebar.tests.ng-binding.ng-scope")
                if test:
                    test.click()
                    time.sleep(10)
                    self.driver.save_screenshot(
                        image_path + "Notifications_english_chrome.png")
                    logging.info(
                        "(Chrome)English Notifications accessed and captured an Image of it.."
                    )

        except Exception as e:
            logging.exception(
                "(Chrome)Issue in func test_viewTabs_English(), inside Notifications Tab - "
                + str(e))
            logging.exception(traceback.format_exc())

    def viewTabs_Japanese(self):
        logging.info("(Chrome)## -- Entering viewTabs_Japanese() method -- ##")
        try:
            logging.info("(Chrome)# --Accessing Japanese Dashboard Tab--")

            # var = 'ダッシュボード'
            # var = ascii(var)
            # var = '\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9'
            logging.info(
                "(Chrome)# --Located and going to click on the Dashboard tab--"
            )
            self.waitByXpath(
                "//a[text()='\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9']")
            dashboard = self.driver.find_element_by_xpath(
                "//a[text()='\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9']")
            dashboard.click()
            time.sleep(10)

            logging.info(
                "(Chrome)# --Locating a heading 'Overall Performance' on the page before taking screenshot--"
            )
            if self.driver.find_element_by_xpath("//div[@class='col-md-3']"):
                self.driver.save_screenshot(image_path +
                                            "Dashboard_japanese_chrome.png")
                logging.info(
                    "(Chrome)Japanese Dashboard accessed and captured an Image of it.."
                )

        except Exception as e:
            logging.exception(
                "(Chrome)Issue in func test_viewTabs_Japanese(), inside Dashboard Tab - "
                + str(e))
            logging.exception(traceback.format_exc())

        try:
            logging.info("(Chrome)# --Accessing Japanese Alerts Tab--")

            # var = 'アラート'
            # var = ascii(var)
            # var = '\u30a2\u30e9\u30fc\u30c8'
            logging.info(
                "(Chrome)# --Located and going to click on the Alerts tab--")
            time.sleep(3)
            self.waitByXpath("//a[text()='\u30a2\u30e9\u30fc\u30c8']")
            alerts = self.driver.find_element_by_xpath(
                "//a[text()='\u30a2\u30e9\u30fc\u30c8']")
            alerts.click()
            time.sleep(10)

            # var = 'アラートステータス'
            # var = ascii(var)
            # var = '\u30a2\u30e9\u30fc\u30c8\u30b9\u30c6\u30fc\u30bf\u30b9'
            logging.info(
                "(Chrome)# --Locating a heading 'Alert Status' on the page before taking screenshot--"
            )
            if self.driver.find_element_by_xpath(
                    "//th[text()='\u30a2\u30e9\u30fc\u30c8\u30b9\u30c6\u30fc\u30bf\u30b9']"
            ):
                self.driver.save_screenshot(image_path +
                                            "Alerts_japanese_chrome.png")
                logging.info(
                    "(Chrome)Japanese Alerts accessed and captured an Image of it.."
                )

        except Exception as e:
            logging.exception(
                "(Chrome)Issue in func test_viewTabs_Japanese(), inside Alerts Tab - "
                + str(e))
            logging.exception(traceback.format_exc())

        try:
            logging.info("(Chrome)# --Accessing Japanese Tests Tab--")

            logging.info(
                "(Chrome)# --Located and going to click on the Tests tab--")
            time.sleep(3)
            # var = 'テスト'
            # var = ascii(var)
            # var = '\u30c6\u30b9\u30c8'
            self.waitByXpath("//a[text()='\u30c6\u30b9\u30c8']")
            tests = self.driver.find_element_by_xpath(
                "//a[text()='\u30c6\u30b9\u30c8']")
            tests.click()
            time.sleep(10)

            # var = 'テストを選択してください。'
            # var = ascii(var)
            # var = '\u30c6\u30b9\u30c8\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002'
            logging.info(
                "(Chrome)# --Locating a heading 'Please select a test' on the page before taking screenshot--"
            )
            if self.driver.find_element_by_xpath(
                    "//span[text()='\u30c6\u30b9\u30c8\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002']"
            ):
                self.driver.save_screenshot(image_path +
                                            "Tests_japanese_chrome.png")
                logging.info(
                    "(Chrome)Japanese Tests accessed and captured an Image of it.."
                )

        except Exception as e:
            logging.exception(
                "(Chrome)Issue in func test_viewTabs_Japanese(), inside Tests Tab - "
                + str(e))
            logging.exception(traceback.format_exc())

        try:
            logging.info("(Chrome)# --Accessing Japanese Variables Tab--")

            # var = '変数'
            # var = ascii(var)
            # var = '\u5909\u6570'
            logging.info(
                "(Chrome)# --Located and going to click on the Variables tab--"
            )
            time.sleep(3)
            self.waitByXpath("//a[text()='\u5909\u6570']")
            tests = self.driver.find_element_by_xpath(
                "//a[text()='\u5909\u6570']")
            tests.click()
            time.sleep(10)

            # var = '変数を選択してください。または、以下のように操作してください。'
            # var = ascii(var)
            # var = '\u5909\u6570\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u307e\u305f\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u64cd\u4f5c\u3057\u3066\u304f\u3060\u3055\u3044\u3002'
            logging.info(
                "(Chrome)# --Locating a heading 'Please select a variable, or the following:' on the page before taking screenshot--"
            )
            if self.driver.find_element_by_xpath(
                    "//div[text()='\u5909\u6570\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u307e\u305f\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u64cd\u4f5c\u3057\u3066\u304f\u3060\u3055\u3044\u3002']"
            ):
                self.driver.save_screenshot(image_path +
                                            "Variables_japanese_chrome.png")
                logging.info(
                    "(Chrome)Japanese Variables accessed and captured an Image of it.."
                )

        except Exception as e:
            logging.exception(
                "(Chrome)Issue in func test_viewTabs_Japanese(), inside Variables Tab - "
                + str(e))
            logging.exception(traceback.format_exc())

        try:
            logging.info("(Chrome)# --Accessing Japanese Notifications Tab--")

            # var = '通知'
            # var = ascii(var)
            # var = '\u901a\u77e5'
            logging.info(
                "(Chrome)# --Located and going to click on the Notifications tab--"
            )
            time.sleep(3)
            self.waitByXpath("//a[text()='\u901a\u77e5']")
            notifications = self.driver.find_element_by_xpath(
                "//a[text()='\u901a\u77e5']")
            notifications.click()
            time.sleep(10)

            # var = '通知を選択してください。'
            # var = ascii(var)
            # var = '\u901a\u77e5\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002'
            logging.info(
                "(Chrome)# --Locating a heading 'Please select a notification' and clicked on 'test' before taking screenshot--"
            )
            if self.driver.find_element_by_xpath(
                    "//span[text()='\u901a\u77e5\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002']"
            ):
                test = self.driver.find_element_by_class_name(
                    "nav.nav-sidebar.tests.ng-binding.ng-scope")
                if test:
                    test.click()
                    time.sleep(10)
                    self.driver.save_screenshot(
                        image_path + "Notifications_japanese_chrome.png")
                    logging.info(
                        "(Chrome)Japanese Notifications accessed and captured an Image of it.."
                    )

        except Exception as e:
            logging.exception(
                "(Chrome)Issue in func test_viewTabs_Japanese(), inside Notifications Tab - "
                + str(e))
            logging.exception(traceback.format_exc())

    #@unittest.skip("Skipping English")
    def test_viewTabs_English(self):
        logging.info(
            "(Chrome)## -- Entering TestCase method 'test_viewTabs_English()' -- ##"
        )
        try:
            self.Empirix_Login()
            time.sleep(2)

            try:
                logging.info(
                    "(Chrome)#--Trying to locate English 'Dashboard' tab on the page"
                )
                dashboard_eng = self.driver.find_element_by_xpath(
                    "//a[text()='Dashboard']")
                if dashboard_eng:
                    self.viewTabs_English()
            except:
                # var = 'ダッシュボード'
                # var = ascii(var)
                # var = '\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9'
                logging.exception(
                    "(Chrome)#--Trying to locate Japanese 'Dashboard' tab on the page(inside except)"
                )
                dashboard_jap = self.driver.find_element_by_xpath(
                    "//a[text()='\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9']")
                if dashboard_jap:
                    logging.exception(
                        "(Chrome)#--Found Japanese, updating language to English"
                    )
                    self.switch_language_toEnglish()
                    self.viewTabs_English()

        except Exception as e:
            logging.exception(
                "(Chrome)Issue in func test_viewTabs_English() - " + str(e))
            logging.exception(traceback.format_exc())

    #@unittest.skip("Skipping japanese")
    def test_viewTabs_Japanese(self):
        logging.info(
            "(Chrome)## -- Entering TestCase method 'test_viewTabs_Japanese()' -- ##"
        )
        try:
            self.Empirix_Login()
            time.sleep(2)

            try:
                # var = 'ダッシュボード'
                # var = ascii(var)
                # var = '\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9'
                logging.info(
                    "(Chrome)#--Trying to locate Japanese 'Dashboard' tab on the page"
                )
                dashboard_jap = self.driver.find_element_by_xpath(
                    "//a[text()='\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9']")
                if dashboard_jap:
                    self.viewTabs_Japanese()
            except:
                logging.exception(
                    "(Chrome)#--Trying to locate English 'Dashboard' tab on the page(inside except)"
                )
                dashboard_eng = self.driver.find_element_by_xpath(
                    "//a[text()='Dashboard']")
                if dashboard_eng:
                    logging.exception(
                        "(Chrome)#--Found English, updating language to Japanese"
                    )
                    self.switch_language_toJapanese()
                    self.viewTabs_Japanese()

        except Exception as e:
            logging.exception("(Chrome)Issue in func viewTabs_Japanese() - " +
                              str(e))
            logging.exception(traceback.format_exc())

    #@unittest.skip("Skipping English")
    def test_clientInfo_check_english(self):
        logging.info(
            "(Chrome)## -- Entering TestCase method 'test_clientInfo_check_english()' -- ##"
        )
        try:
            self.Empirix_Login()
            time.sleep(2)

            logging.info("(Chrome)# --Going to click on Profile dropdown--")
            profile_dropdown = self.driver.find_element_by_link_text(
                'QA_traininguser25(Empirix_QA_Training)')
            profile_dropdown.click()
            time.sleep(5)

            try:
                logging.info(
                    "(Chrome)# --Going to click on English 'Client' from the dropdown menu--"
                )
                client_eng = self.driver.find_element_by_xpath(
                    "//span[text()='Client']")
                if client_eng:
                    client_eng.click()
                    time.sleep(10)
                    logging.info(
                        "(Chrome)# --Locating a heading 'Client Details' in English on the page before taking screenshot--"
                    )
                    if self.driver.find_element_by_class_name('panel-title'):
                        self.driver.save_screenshot(
                            image_path + "ClientDetails_english_chrome.png")
                        logging.info(
                            "(Chrome)Client Details accessed in English and captured an Image of it.."
                        )
                        logging.info(
                            "(Chrome)TestCase:: Client Details accessed in 'English' Successfully : PASS"
                        )
            except:
                # var = 'クライアント'
                # var = ascii(var)
                # var = '\u30af\u30e9\u30a4\u30a2\u30f3\u30c8'
                logging.exception(
                    "(Chrome)# --Checking for a Japanese 'Client' from the dropdown menu(inside except)--"
                )
                client_jap = self.driver.find_element_by_xpath(
                    "//span[text()='\u30af\u30e9\u30a4\u30a2\u30f3\u30c8']")
                if client_jap:
                    profile_dropdown.click()
                    time.sleep(5)
                    logging.exception(
                        "(Chrome)#--Found Japanese, updating language to English"
                    )
                    self.switch_language_toEnglish()
                    try:
                        profile_dropdown = self.driver.find_element_by_link_text(
                            'QA_traininguser25(Empirix_QA_Training)')
                        if profile_dropdown:
                            profile_dropdown.click()
                            time.sleep(3)
                            logging.exception(
                                "(Chrome)# --Going to click on English 'Client' from the dropdown menu once language is changed--"
                            )
                            client_eng = self.driver.find_element_by_xpath(
                                "//span[text()='Client']")
                            if client_eng:
                                client_eng.click()
                                time.sleep(10)
                                logging.exception(
                                    "(Chrome)# --Locating a heading 'Client Details' in English on the page before taking screenshot--"
                                )
                                if self.driver.find_element_by_class_name(
                                        'panel-title'):
                                    self.driver.save_screenshot(
                                        image_path +
                                        "ClientDetails_english_chrome.png")
                                    logging.exception(
                                        "(Chrome)Client Details accessed in English and captured an Image of it.."
                                    )
                                    logging.exception(
                                        "(Chrome)TestCase:: Client Details accessed in 'English' Successfully : PASS"
                                    )
                    except:
                        logging.exception(
                            "(Chrome)TestCase:: Client Details accessed in 'English' Successfully(language not changed or Page load issue) : FAIL"
                        )

        except Exception as e:
            logging.exception(
                "(Chrome)TestCase:: Client Details accessed in 'English' Successfully(inside except) : FAIL"
            )
            logging.exception(
                "(Chrome)Issue in func test_clientInfo_check_english() - " +
                str(e))
            logging.exception(traceback.format_exc())

    #@unittest.skip("Skipping japanese")
    def test_clientInfo_check_japanese(self):
        logging.info(
            "(Chrome)## -- Entering TestCase method 'test_clientInfo_check_japanese()' -- ##"
        )
        try:
            self.Empirix_Login()
            time.sleep(2)

            logging.info("(Chrome)# --Going to click on Profile dropdown--")
            profile_dropdown = self.driver.find_element_by_link_text(
                'QA_traininguser25(Empirix_QA_Training)')
            profile_dropdown.click()
            time.sleep(3)

            try:
                # var = 'クライアント'
                # var = ascii(var)
                # var = '\u30af\u30e9\u30a4\u30a2\u30f3\u30c8'
                logging.info(
                    "(Chrome)# --Going to click on Japanese 'Client' from the dropdown menu--"
                )
                client_jap = self.driver.find_element_by_xpath(
                    "//span[text()='\u30af\u30e9\u30a4\u30a2\u30f3\u30c8']")
                if client_jap:
                    client_jap.click()
                    time.sleep(10)
                    logging.info(
                        "(Chrome)# --Locating a heading 'Client Details' in Japanese on the page before taking screenshot--"
                    )
                    if self.driver.find_element_by_class_name('panel-title'):
                        self.driver.save_screenshot(
                            image_path + "ClientDetails_japanese_chrome.png")
                        logging.info(
                            "(Chrome)Client Details accessed in Japanese and captured an Image of it.."
                        )
                        logging.info(
                            "(Chrome)TestCase:: Client Details accessed in 'Japanese' Successfully : PASS"
                        )
            except:
                logging.exception(
                    "(Chrome)# --Checking for a English 'Client' from the dropdown menu(inside except)--"
                )
                client_eng = self.driver.find_element_by_xpath(
                    "//span[text()='Client']")
                if client_eng:
                    profile_dropdown.click()
                    time.sleep(3)
                    logging.exception(
                        "(Chrome)#--Found English, updating language to Japanese"
                    )
                    self.switch_language_toJapanese()
                    try:
                        profile_dropdown = self.driver.find_element_by_link_text(
                            'QA_traininguser25(Empirix_QA_Training)')
                        if profile_dropdown:
                            profile_dropdown.click()
                            time.sleep(3)
                            logging.exception(
                                "(Chrome)# --Going to click on Japanese 'Client' from the dropdown menu once language is changed--"
                            )
                            client_jap = self.driver.find_element_by_xpath(
                                "//span[text()='\u30af\u30e9\u30a4\u30a2\u30f3\u30c8']"
                            )
                            if client_jap:
                                client_jap.click()
                                time.sleep(10)
                                logging.exception(
                                    "(Chrome)# --Locating a heading 'Client Details' in Japanese on the page before taking screenshot--"
                                )
                                if self.driver.find_element_by_class_name(
                                        'panel-title'):
                                    self.driver.save_screenshot(
                                        image_path +
                                        "ClientDetails_japanese_chrome.png")
                                    logging.exception(
                                        "(Chrome)Client Details accessed in Japanese and captured an Image of it.."
                                    )
                                    logging.exception(
                                        "(Chrome)TestCase:: Client Details accessed in 'Japanese' Successfully : PASS"
                                    )
                    except:
                        logging.exception(
                            "(Chrome)TestCase:: Client Details accessed in 'Japanese' Successfully(language not changed or Page load issue) : FAIL"
                        )

        except Exception as e:
            logging.exception(
                "(Chrome)TestCase:: Client Details accessed in 'Japanese' Successfully(inside except) : FAIL"
            )
            logging.exception(
                "(Chrome)Issue in func test_clientInfo_check_japanese() - " +
                str(e))
            logging.exception(traceback.format_exc())

    def tearDown(self):
        logging.info("(Chrome)## -- Entering tearDown() method -- ##")
        try:
            self.driver.quit()
        except Exception as e:
            logging.exception("(Chrome)Issue in func tearDown() - " + str(e))
            logging.exception(traceback.format_exc())
コード例 #22
0
ファイル: ATest.py プロジェクト: saikiran0454/demo_sample_new
import time
from selenium.webdriver import Chrome, ActionChains
from selenium.webdriver.common.keys import Keys

driver = Chrome((
    r"C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\chromedriver_win32\chromedriver.exe"
))
driver.maximize_window()
driver.implicitly_wait(30)
driver.get("https://www.google.com/")
time.sleep(5)
#Step1
element = driver.find_element_by_link_text('Gmail')
#Step2
act = ActionChains(driver)
#Step3
act.click(element).perform()
driver.close()
コード例 #23
0
ファイル: main.py プロジェクト: gsugar87/autoVenmo
CHROME_DRIVER_PATH = 'C:\ChromeDriver\chromedriver.exe'
VENMO_URL = 'https://venmo.com/'

browser = Chrome(CHROME_DRIVER_PATH)
browser.get(VENMO_URL)

if os.path.isfile('cookies.pkl'):
    # there is a cookie file

    cookies = pickle.load(open("cookies.pkl", "rb"))
    for cookie in cookies:
        browser.add_cookie(cookie)

    # click on the sign in link
    signin_link = browser.find_element_by_link_text("Sign in")
    signin_link.click()

    # enter the email and password and send it
    username_box = browser.find_element_by_class_name("email-username-phone")
    username_box.send_keys(venmoInfo.my_u)
    password_box = browser.find_element_by_class_name("password")
    password_box.send_keys(venmoInfo.my_p)
    send_button = browser.find_element_by_class_name("login")
    send_button.click()

    # enter the person's name you want to pay
    time.sleep(5)
    name_box = browser.find_element_by_class_name("onebox_prefill")
    name_box.click()
    name_text_box = browser.find_element_by_class_name("paddingUnifier")
コード例 #24
0
def main():
    my_username = input('Enter your username: '******'Enter your Twitter Password : '******'https://twitter.com/login')

    username = driver.find_element_by_xpath('.//input[@name="session[username_or_email]"]')
    username.send_keys(my_username')

    sleep(2)

    password = driver.find_element_by_xpath('.//input[@name="session[password]"]')
    password.send_keys(my_password)

    sleep(2)

    password.send_keys(Keys.RETURN)

    sleep(2)

    search = driver.find_element_by_xpath('.//input[@aria-label="Search query"]')
    search.send_keys(search_term)
    sleep(1)
    search.send_keys(Keys.RETURN)

    sleep(2)

    #latest
    driver.find_element_by_link_text('Latest').click()

    sleep(2)

    #latest
    driver.find_element_by_link_text('Latest').click()

    sleep(2)

    tweet_data = [] #it will store tuple of extracted tweet data
    tweet_ids = set()
    last_postion = driver.execute_script("return window.pageoffset;")
    scrolling = True

    while scrolling :
        #getting_post
        posts = driver.find_elements_by_xpath('.//div[@data-testid="tweet"]')
        for post in posts[-15:]:
            data = get_tweet_data()
            
            tweet_id = ''.join(data)
            if tweet_id not in tweet_ids:
                tweet_ids.add(tweet_id)
                tweet_data.append(data)
                
        scroll_attempt = 0
        while True:
            driver.execute_script('window.scrollTo(0, document.body.scrollHeight);')
            sleep(2)
            current_postion = driver.execute_script("return window.pageoffset;")
            
            if last_postion == current_postion:
                
                scroll_attempt += 1
                
                if scroll_attempt == 2:
                    scrolling = False
                    break
                else:
                    sleep(2) #attemp to scroll again
            else:
                last_postion = current_postion
                break
    log_out()
    
    #all the record will be stored in a results.csv file
    with open(f'{search_term}_related_tweet.csv','w',newline='',encoding='utf-8') as f:
        writer = csv.writer(f)
        writer.writerow(['Accout Name','User Name','Timestamp','Contents','Likes','Comments','Retweets'])
        writer.writerows(tweet_data)
コード例 #25
0
ファイル: tut_alert.py プロジェクト: zenki209/python-note
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException


url = "http://www.teachmeselenium.com/automation-practice"
chrome_path = '/home/xuananh/data/Downloads/chromedriver_linux64/chromedriver'
# chrome driver download from link: https://chromedriver.storage.googleapis.com/index.html?path=2.44/

chrome_option = ChromeOptions()
driver = Chrome(executable_path=chrome_path,
                chrome_options=chrome_option)
driver.maximize_window()
driver.get(url)

# click on link to create alert
driver.find_element_by_link_text("Click Me to get Alert").click()

try:
    alert = WebDriverWait(driver, 3).until(EC.alert_is_present(),
                                           'Timed out waiting for PA creation ' +
                                           'confirmation popup to appear.')

    # alert = driver.switch_to.alert
    print(alert.text)
    alert.accept()
    print("alert accepted")
    # alert.dismiss()
except TimeoutException:
    print("no alert")
コード例 #26
0
driver = Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe")

#driver.get("http://www.baidu.com/")
driver.get("https://www.rjs.com/member/user.html#login")
assert u"融金所" in driver.title
element = driver.find_element_by_id("login_username")
element.clear()
element.send_keys("Groningen")
element = driver.find_element_by_id("login_pwd")
element.clear()
element.send_keys("zpl177l36h")
element.send_keys(Keys.RETURN)
time.sleep(3)
#  进入【我要投标】
element = driver.find_element_by_link_text(u"我要投标")
element.send_keys(Keys.RETURN)
time.sleep(2)
# 点击加入

refresh = True
while( refresh ):
    try:
        driver.refresh() # refresh
        css = "#investWrap > div:nth-child(10) > div > ul > li:nth-child(1) > table > tbody > td.td5 > button"
        element = driver.find_element_by_css_selector(css)
        print('优选[',element.text,']')
        if( element.text == '立即加入' ):
            refresh = False
            element.click()
        else:
コード例 #27
0
ファイル: yandex_noad.py プロジェクト: skiboorg/wordstat
        )
        search_field.clear()
    else:

        search_field = browser.find_element_by_css_selector(
            'input[class="input__control"]')
        search_button = browser.find_element_by_css_selector(
            'button[class="websearch-button suggest2-form__button"]')
        search_field.clear()
    search_field.send_keys(search_string)
    sleep(random.randint(5, 10) / 100)
    search_button.click()
    i += 1
    sleep(random.randint(5, 10) / 100)
    while ii < pages:
        next = browser.find_element_by_link_text('дальше')
        next.click()

        results = browser.find_elements_by_xpath(
            '/html/body/div[3]/div[1]/div[2]/div[1]/div[1]/ul/li[*]')

        for result in results:
            #if 'реклама' not in result.text:
            # print(result.get_attribute('innerHTML'))

            try:
                print(
                    result.find_element_by_css_selector(
                        'a[class="link link_theme_outer path__item i-bem"]').
                    text)
                all_sites[search_string].append(
コード例 #28
0
from selenium.webdriver import Chrome
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
import platform
from webdriver_manager.chrome import ChromeDriverManager
import time
if platform.system() == "Windows":
    driver = Chrome(executable_path="D:\\Drivers\\chromedriver.exe")
elif platform.system() == "Darwin":
    driver = Chrome(ChromeDriverManager().install())
url = "https://demo.midtrans.com/"
driver.get(url)
driver.maximize_window()
buyNow = driver.find_element_by_link_text('BUY NOW')
buyNow.click()
time.sleep(5)
#-----------Shopping Cart--------
# innerWin = driver.find_element_by_xpath("//div[@id='container']/div/div/div[2]/div[1]")
innerWin = driver.find_element_by_css_selector(".cart-inner")
innerWin.click()
time.sleep(3)
# newWin = driver.find_element_by_xpath("//span[contains(text(),'Shopping Cart')]")
# newWin.send_keys(Keys.NULL)//div[4]/table/tbody/tr[1]/td[2]/input
Name = innerWin.find_element_by_xpath("div[4]/table/tbody/tr[1]/td[2]/input")
Name.clear()
#    "/div/div[4]/table/tbody/tr/td[contains(text(),'Name')]")
Name.send_keys("Jhon")
Email = innerWin.find_element_by_xpath("div[4]/table/tbody/tr[2]/td[2]/input")
Email.clear()
Email.send_keys("*****@*****.**")
Phone = innerWin.find_element_by_xpath("div[4]/table/tbody/tr[3]/td[2]/input")
コード例 #29
0
                            zzz += 1
                    # print(writein)

                    # 自動換頁
                    if num100 == '1':
                        test2 = 0
                    else:
                        try:
                            test2 = int(a) + int(bb)
                        except:
                            test2 = a + bb

                    if str(test2) == str(num100):
                        pass
                    else:
                        driver.find_element_by_link_text(str(int(num100) + 1)).click()

                    time.sleep(3)
            except:
                pass

            # 關閉當前視窗
            driver.close()
            time.sleep(2)
            # 切換到原本視窗
            driver.switch_to_window(windows[0])

    #自動換頁條件
    if num3 == '1':
        test = 0
    else:
コード例 #30
0
class BrowserstackCrawler(object):
    def __init__(self):
        options = ChromeOptions().add_argument(
            "--user-data-dir=<chrome user profile>")
        self.browser = Chrome(
            executable_path=
            r"C:\\Users\\hp\\Downloads\\chromedriver_win32\\chromedriver.exe",
            chrome_options=options)
        self.browser.get(BASE_URL)
        time.sleep(5)

    def signup(self):
        self.browser.find_element_by_link_text("Sign Up").click()
        time.sleep(2)
        username = self.browser.find_element_by_id('username')
        self.slow_typing(username, 'KaranAg')
        time.sleep(1)
        email = self.browser.find_element_by_id('email')
        self.slow_typing(email, EMAIL_ID)
        time.sleep(2)
        password = self.browser.find_element_by_id('password')
        with open('password.txt', 'r') as myfile:
            Password = myfile.read().replace('\n', '')
        self.slow_typing(password, Password)
        time.sleep(2)
        confirm_password = self.browser.find_element_by_id('confirm_password')
        with open('password.txt', 'r') as myfile:
            Password = myfile.read().replace('\n', '')
        self.slow_typing(confirm_password, Password)
        time.sleep(1)
        submit = self.browser.find_element_by_id('submit')
        submit.click()
        time.sleep(10)
        self.close_browser()

    def userlogin(self):
        self.browser.find_element_by_link_text("Login").click()
        time.sleep(2)
        email = self.browser.find_element_by_id('email')
        self.slow_typing(email, EMAIL_ID)
        time.sleep(2)
        password = self.browser.find_element_by_id('password')
        with open('password.txt', 'r') as myfile:
            Password = myfile.read().replace('\n', '')
        self.slow_typing(password, Password)
        time.sleep(1)
        submit = self.browser.find_element_by_id('submit')
        submit.click()
        time.sleep(3)
        self.browser.find_element_by_link_text("ANALYSIS").click()
        time.sleep(10)
        self.browser.find_element_by_link_text("LOGOUT").click()
        self.close_browser()

    def slow_typing(self, element, text):
        for character in text:
            element.send_keys(character)
            time.sleep(0.3)

    def check_color(self, color, orginal_color):
        return color == orginal_color

    def close_browser(self):
        self.browser.close()
コード例 #31
0
sleep(1)
driver.find_element_by_class_name('login-rightTab').click()
print(driver.find_element_by_id('username').get_attribute('type'))
#输入账号密码
driver.find_element_by_id('username').send_keys("18610229039")
sleep(1)
print(
    'username='******'//*[@id="username"]').get_attribute('value'))
driver.find_element_by_id('password').send_keys("891655")
sleep(1)
print('password='******'password').get_attribute('value'))
#单击登录按钮
driver.find_element_by_xpath('//*[@id="loginsubmit"]').click()
sleep(1)
driver.get('http://guide.medlive.cn/guideline/19012')
sleep(1)
print(
    driver.find_element_by_xpath(
        '//*[@id="_article_viewer_1"]/div/div[2]/a').get_attribute('fn'))
print(
    driver.find_element_by_xpath(
        '//*[@id="_article_viewer_1"]/div/div[2]/a').is_enabled())
driver.find_element_by_xpath(
    '//*[@id="_article_viewer_1"]/div/div[2]/a').click()
driver.get('http://guide.medlive.cn/guideline/19007')
driver.find_element_by_link_text('下载').click()
sleep(10)
driver.close()
コード例 #32
0
CHROME_DRIVER_PATH = 'C:\ChromeDriver\chromedriver.exe'
VENMO_URL = 'https://venmo.com/'

browser = Chrome(CHROME_DRIVER_PATH)
browser.get(VENMO_URL)

if os.path.isfile('cookies.pkl'):
    # there is a cookie file

    cookies = pickle.load(open("cookies.pkl", "rb"))
    for cookie in cookies:
        browser.add_cookie(cookie)

    # click on the sign in link
    signin_link = browser.find_element_by_link_text("Sign in")
    signin_link.click()

    # enter the email and password and send it
    username_box = browser.find_element_by_class_name("email-username-phone")
    username_box.send_keys(venmoInfo.my_u)
    password_box = browser.find_element_by_class_name("password")
    password_box.send_keys(venmoInfo.my_p)
    send_button = browser.find_element_by_class_name("login")
    send_button.click()

    # enter the person's name you want to pay
    time.sleep(5)
    name_box = browser.find_element_by_class_name("onebox_prefill")
    name_box.click()
    name_text_box = browser.find_element_by_class_name("paddingUnifier")