How to consecutively call asynchronous functions in Javascript

Advertisements everyone, in my school, i have a project that i code javascript to automated test a page i use webdriver to text but i have a error : TypeError: loginPageInstance.inputUsername(…).inputPassword is not a function at Context. (D:\PVD_HOCTAP\Back End\Javascript\Automated_Testing_demo\test\pageObject2\testScript/testLogin.js:18:67) I still don’t know how to fix it. I hope everyone will help me. Sorry for… Read More How to consecutively call asynchronous functions in Javascript

How to click on the checkbox using Selenium Javascript and Xpath?

Advertisements I am trying to target the checkbox to agree to the terms and conditions but have no name or id to use to target. I have innerHTML and innerText that I am trying to target with selenium but am only encountering errors. I am using Javascript and testing on chrome. Code trial: await driver.findElement(By.xpath("//*innerText[text()=’I… Read More How to click on the checkbox using Selenium Javascript and Xpath?

Selenium Python just gives one result

Advertisements Selenium is only returning me first result. My code: from selenium.webdriver.common.by import By from selenium import webdriver import pandas as pd url = ‘https://www.tajeran-group.de/fahrzeuge/’ PATH = ‘C:\\Users\\czoca\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Python 3.6\\chromedriver.exe’ driver = webdriver.Chrome(PATH) driver.get(url) driver.maximize_window()# For maximizing window driver.implicitly_wait(15)# gives an implicit wait for 20 seconds dealers = driver.find_elements(By.XPATH, ‘/html/body/div[1]/div[4]/div/div[3]/div[1]/div’) for n in dealers: name… Read More Selenium Python just gives one result

Selenium can't get this class

Advertisements I’m trying to get the button clicked but Selenium cant reach that class : access-grants__flows-area__create-button container key_cli_btn = self._get_xpath("//div[@class=’/html/body/div/div/div[1]/div/div[3]/div/div[2]/div[2]/div[3]/div[4]/div’") print(key_cli_btn) This xpath is invalid : selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: `Unable to locate an element with the xpath expression //div[@class=’/html/body/div/div/div[1]/div/div[3]/div/div[2]/div[2]/div[3]/div[4]/div’ because of the following error: `SyntaxError: Failed to execute ‘evaluate’ on ‘Document’: The string ‘//div[@class=’/html/body/div/div/div[1]/div/div[3]/div/div[2]/div[2]/div[3]/div[4]/div”… Read More Selenium can't get this class

Finding elements by class name inside a loop, selenium

Advertisements I need to scrape in python a page that has some classes that are number like class1, class2, class3, … classN and I would like to locate the text contained in all those classes. I tried using find_element() function: list = [] for i in range(N-1) list.append(driver.find_element(By.CLASS_NAME, "class" + str(i+1) ).text)) but unfortunately I… Read More Finding elements by class name inside a loop, selenium

XPath – Select Elements at the first level ex: after Html tag all child tags

Advertisements So say I have a html structure like so <!DOCTYPE HTML> <html> <body><child></child></body> <div></div> <div><child></child></div> <script><child></child></script> <iframe></iframe> <div></div> </html> say I only wanted to get the children of the html tag and not the decendents of these children I would do something like: webDriver.findElements(By.xpath("//html/*[not(*)]")) and perhaps before I run that line I would wait… Read More XPath – Select Elements at the first level ex: after Html tag all child tags

Cant get logging element

Advertisements When i was testing my program, it’s end with code 1 here is full error ("Traceback (most recent call last): File "C:\Users\ds072\PycharmProjects\pythonProject\main.py", line 20, in <module> wait.until(EC.element_to_be_clickable((By.XPATH, "/html/body/main/div/div/div/div[1]/div[3]/div[1]/div[1]/input"))).send_keys("my username")") here is my code (https://pastebin.com/RThnY8GY) I have tested alternatives for this value ("/html/body/main/div/div/div/div[1]/div[3]/div[1]/div[1]/input") but with out results :C Please help me >Solution : The following… Read More Cant get logging element

How to select multiple alternate checkboxes in selenium webdriver

Advertisements driver.get("183.82.103.245/nareshit/login.php"); driver.findElement(By.name("txtUserName")).sendKeys("nareshit"); driver.findElement(By.name("txtPassword")).sendKeys("nareshit"); driver.findElement(By.name("Submit")).click(); Thread.sleep(3000); driver.switchTo().frame("rightMenu"); List<WebElement> AllCheckboxes = driver.findElements(By.xpath("//input[@type=’checkbox’]"));; int size = AllCheckboxes.size(); System.out.println(size); for(int i=0;i<size;i++) { (AllCheckboxes).get(i).click(); } Thread.sleep(5000); driver.close(); } }How to select multiple alternate checkboxes in selenium webdriver? I have written code for selecting multiple checkboxes at a time. I I wanted to try for clicking on multiple alternate checkboxes.… Read More How to select multiple alternate checkboxes in selenium webdriver

Where to set the path to webdriver.chrome.driver (Java, Selenium, IntelliJ)?

Advertisements So I’m working with Selenium IDE and it beautifully generated the code for me. But I have an issue with webdriver. This is the code. package org.example;// Generated by Selenium IDE import org.junit.Test; import org.junit.Before; import org.junit.After; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.Dimension; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.JavascriptExecutor; import java.util.*; public… Read More Where to set the path to webdriver.chrome.driver (Java, Selenium, IntelliJ)?