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
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
1
You can use //mat-option/span[condition1 or condition2 or condition3]
With XPath 2.0 or higher you could also use
//mat-option/span[matches(., 'aaa|bbb|ccc')]
But sadly the developers of Selenium are still stuck on XPath 1.0.
Are you sure you want "text()" here rather than "."? With text(), the text must all be in one text node: no ...
1
// GIVEN that I am an anonymous user on the Instruct Counsel page
driver.get("https://www.lexology.com/instructcounsel/find");
// WHEN I press the Example button
driver.findElement(By.xpath("//div[@id='do-example-search']/button")).click();
driver.get should wait for the page to load, but that doesn't mean the button is ready to be ...
1
try
List<WebElement> list = driver.findElements(By.tagname("option"));
list.get(<index number of the selection>).click();
1
Your element is not visible or covered by another opened element (for example dropdown, modal window).
This is the exact same problem. Check it out https://stackoverflow.com/questions/44119081/how-do-you-fix-the-element-not-interactable-exception
Make sure your element is visible before clicking it or sending text if it is an input field.
You use:
((...
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])
1
You can run Maven in dry run mode, so it will perform the maven test lifecycle, but without executing the tests:
mvn release:prepare -DdryRun=true
Then you can pipe the output into grep to look for the pattern that contains the info you are looking for.
1
You can make a call to TestRail's endpoint add_result_for_case.
Example in Java:
Map data = new HashMap();
data.put("status_id", new Integer(1));
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/1/1", data);
You can find the definition of the endpoint here.
You can find the complete documentation here and some extra ...
1
ChromeOptions chromeOptions = new ChromeOptions();
String proxyadd = "176.9.119.170:8080";
Proxy proxy = new Proxy();
proxy.setHttpProxy(proxyadd);
proxy.setSslProxy(proxyadd);
chromeOptions.setCapability("proxy", proxy);
WebDriver driver = new ChromeDriver(chromeOptions);
There is a proxy class that can be used to set proxy including ...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
selenium-webdriver × 6252automated-testing × 1689
java × 1077
selenium2 × 540
python × 396
c# × 384
browser-automation × 314
xpath × 292
testng × 275
javascript × 180
test-automation-framework × 153
page-objects × 149
chromedriver × 140
appium × 98
protractor × 95
selenium-ide × 93
cucumber × 80
firefoxdriver × 76
eclipse × 73
junit × 71
selenium3 × 63
jenkins × 61
selenium-webdriver-c# × 54
chrome × 53
ruby × 49