see all blog articles

mah boi

Author Image

Cesar Rodriguez

Quality Assurance

Team Member
JavaScript
public class Main {
  public static void main(String[] args) {
    int choice = 2;

    // 1 = Coffee
    // 2 = Tea

    switch () {
      case:
        System.out.println("You ordered Coffee");

      case:
        System.out.println("You ordered Tea");

        System.out.println("Invalid choice");
    }
  }
}

Loading post from X…

JavaScript
import logging

#options = Options()
options = webdriver.ChromeOptions()
optionsG = webdriver.FirefoxOptions()
service = Service()
#options.set_capability(
#    "goog:loggingPrefs", {"performance": "ALL", "browser": "ALL"}
#)
#options.log_path='/home/cesarin/IdeaProjects/Seleniumtest1/geckodriver_log_path.log'
#options.add_argument("--enable-logging --v=1")
#options.add_argument("--log-level=3")
options.enable_bidi = True
options.add_argument("----mute-audio")
#options.add_argument("--auto-open-devtools-for-tabs")
#options.add_argument("--window-size=2560,1440")
#options.add_argument("--headless")
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage') 
options.add_argument("--start-maximized")
optionsG.add_argument("--mute-audio")
#options.add_argument("--auto-open-devtools-for-tabs")
#options.add_argument("--window-size=2560,1440")
#options.add_argument("--headless")
optionsG.add_argument('--no-sandbox')
optionsG.add_argument('--disable-dev-shm-usage') 
optionsG.add_argument("--start-maximized")
ua = UserAgent()
#my_user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36"
options.add_argument(f"--user-agent={ua.random}") #generates random user agents to prevent blockades.
#options.set_capability('goog:loggingPrefs', {'performance': 'ALL'}) 

page = "https://staging-scbc.acorninteractive.ca/action_centre/newmode-form-test/"

def setChromeDriver():
    print("Phase 1: Setting up Chrome webDriver...")
    ChromewebDriver = webdriver.Chrome(service=service, options=options)
    #log_entries = webDriver.get_log("performance")
    #ChromewebDriver.script.add_console_message_handler(log_entries.append)
    cWait = WebDriverWait(ChromewebDriver, timeout=8)
    ChromewebDriver.implicitly_wait(8)
    ChromewebDriver.maximize_window()
    return ChromewebDriver
    


def setGeckoDriver():
    print("Phase 1: Setting up Chrome webDriver...")
    GeckowebDriver = webdriver.Firefox()
    #log_entries = webDriver.get_log("performance")
    #GeckowebDriver.script.add_console_message_handler(log_entries.append)
    gWait = WebDriverWait(GeckowebDriver, timeout=8)
    GeckowebDriver.implicitly_wait(8)
    GeckowebDriver.maximize_window()
    return GeckowebDriver

def randomPerson():
    fake = Faker(['en_CA'])
    fakename = fake.first_name()
    fakelastname = fake.last_name()
    fakeaddress = fake.street_address()
    fakecity = fake.city()
    fakephone = fake.phone_number()
    fakecode = fake.postcode()
    fakelipsum = fake.text()
    fakeemail = fake.email()
   
    return fakename,fakelastname,fakeemail, fakeaddress,fakecity, fakecode,fakephone, fakelipsum
def getScreenshot(webDriver):
    now = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
    webDriver.get_screenshot_as_file('screenshot-%s.png' % now)


def expand_shadow_element(element, webDriver): #works to expand shadow root/shadow doom style elements not visible to selenium
 shadow_root = webDriver.execute_script('return arguments[0].shadowRoot', element)
  return shadow_root



def asertFindIframe(webDriver):
    webDriver = webDriver
    actions = ActionChains(webDriver)
    try:  #iframe visibility assert
        image1 = webDriver.find_element(By.CSS_SELECTOR, "#newmodeBanner > img")
        assert image1.is_displayed(), "✗ Assertion Failed: Image is not displayed"
        print("✓ Assertion passed: Image HERO is visible")

LE block

Please fill the form


    1. one
      1. two
        1. three
          1. four
    2. five

  • pagus

    Desperaux

    pagus

    Section Latesttesttesttesbel

    test

    Before YafterX Ghost Job

    python
    
    import logging
    
    #options = Options()
    options = webdriver.ChromeOptions()
    optionsG = webdriver.FirefoxOptions()
    service = Service()
    #options.set_capability(
    #    "goog:loggingPrefs", {"performance": "ALL", "browser": "ALL"}
    #)
    #options.log_path='/home/cesarin/IdeaProjects/Seleniumtest1/geckodriver_log_path.log'
    #options.add_argument("--enable-logging --v=1")
    #options.add_argument("--log-level=3")
    options.enable_bidi = True
    options.add_argument("----mute-audio")
    #options.add_argument("--auto-open-devtools-for-tabs")
    #options.add_argument("--window-size=2560,1440")
    #options.add_argument("--headless")
    options.add_argument('--no-sandbox')
    options.add_argument('--disable-dev-shm-usage') 
    options.add_argument("--start-maximized")
    optionsG.add_argument("--mute-audio")
    #options.add_argument("--auto-open-devtools-for-tabs")
    #options.add_argument("--window-size=2560,1440")
    #options.add_argument("--headless")
    optionsG.add_argument('--no-sandbox')
    optionsG.add_argument('--disable-dev-shm-usage') 
    optionsG.add_argument("--start-maximized")
    ua = UserAgent()
    #my_user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (K
    
    Author Image

    Cesar Rodriguez

    Quality Assurance