New answers tagged

0

You can change the script, putting code in a loop: def submit_form(): driver.find_element_by_class_name("submit").click() time.sleep(2.5) driver.find_element_by_xpath("//input[@value='Continue >>']").click() time.sleep(2.5) driver.find_element_by_class_name("submit").click() time.sleep(2.5) driver....


0

If you are sure that your search criteria is the text, you can use XPath: "//*[text()='Começa a new game']"


3

You are creating the Browser object inside the login function. When it ends, it is eligible for garbage collection. You can pass a pointer to an object outside the function, so it will still have a reference when the function ends. driver = webdriver.Chrome(executable_path="C:\Program Files (x86)\chromedriver.exe",options=chrome_options); login(&...


2

driver.get( "http://www.uitestingplayground.com/scrollbars") time.sleep(10) driver.execute_script( "arguments[0].scrollIntoView({'block':'center','inline':'center'})", driver.find_element_by_id("hidingButton")) https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView use inline and block options


1

from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,"xpath of drop down"))).click() WebDriverWait(driver,10).until(EC.visibility_of_element_located( (By.XPATH, "...


1

It will depend on what you want to tell in your code. If you want to remove the text "end-bubble bubble", then you can use replace: service_status.replace('end-bubble bubble','') If you want to explicitly only take the last word of the string, you can use deconstruction: _, _, last = service_status.split() Or if you want to be more cryptic (don't ...


1

You can use Python's .split() function. Change the last line of your script to print(service_status.split(' ')[2])


2

xpath: //*[contains(@id,"ember")]/input or //*[starts-with(@id,"ember")]/input css [id*="ember"]>input or [id^="ember"]>input is css for contains and ^ start with for css you can use any of the above locator to find the search field in linkedin


0

You can use partial matches with css selectors. So where you have id=ember26 above, in that case, you could use: css=input[id^='ember'] (the ^ means starts with) You can also use endswidth, and contains. A great write up I found on all the different ways of handling dynamic cases will hopefully help.


0

Here is the ultimate solution specifically when you are dealing with Angular 7 or 8. Instead of waiting for a longer duration using sleep or implicit wait methods, you can divide your wait time into the partition and use it recursively. Below logic will wait for the page to render for a minimum of 300 seconds and a maximum of 900 seconds. /** * This method ...


Top 50 recent answers are included