Closed GerhardKreuzer closed 5 years ago
Is your page loaded completely? I see name="q" in google.co.in web page. So it should work.
Hi,
I just cut n paste the sample into my console project. When I start a command window opens and a second window opens showing the google site.
When I try to set a break point, it halts there and I immediately get the error, that the current window lost focus …
Without a breakpoint I get the error message, that I can’t find “q” … sorry.
I tried to send the screen shot with the original message, but this fails ..
Is there a chance to use Selenium without this to windows open? I need just headless functionality. If not, how can I single step through my code?
With best regards
Gerhard
Von: Omkar Nath Singh [mailto:notifications@github.com] Gesendet: Freitag, 22. März 2019 09:39 An: SeleniumHQ/selenium Cc: Gerhard; Author Betreff: Re: [SeleniumHQ/selenium] Sample fails (#7051)
Is your page loaded completely? I see name="q" in google.co.in web page. So it should work.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/selenium/issues/7051#issuecomment-475536006 , or mute the thread https://github.com/notifications/unsubscribe-auth/AEA-59JnCzlPasddEAoRI8QyW6i9-yvYks5vZJa6gaJpZM4cCT9o . https://github.com/notifications/beacon/AEA-58GTM9CJEhPznXdSXP9GljoZW_jTks5vZJa6gaJpZM4cCT9o.gif
Hi,
found the problem. I used the IE version of the driver but Edge is installed here. You didn’t get a nice error message in this case …
Next problem.
To keep the sample project intact, I made a new one and copy the sample code to have a starting point. This time the command window starts, the browser starts, but then I get an error, connection closed cause unexpected error …
I can run the old one, no problem, I can’t run the new one
With best regards
Gerhard
Von: Omkar Nath Singh [mailto:notifications@github.com] Gesendet: Freitag, 22. März 2019 09:39 An: SeleniumHQ/selenium Cc: Gerhard; Author Betreff: Re: [SeleniumHQ/selenium] Sample fails (#7051)
Is your page loaded completely? I see name="q" in google.co.in web page. So it should work.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/selenium/issues/7051#issuecomment-475536006 , or mute the thread https://github.com/notifications/unsubscribe-auth/AEA-59JnCzlPasddEAoRI8QyW6i9-yvYks5vZJa6gaJpZM4cCT9o . https://github.com/notifications/beacon/AEA-58GTM9CJEhPznXdSXP9GljoZW_jTks5vZJa6gaJpZM4cCT9o.gif
Hi,
found the Problem. Used the IE Driver Version but Edge is installed here .. You don't get a nice error message, only a very misleading one.
New Problem. To Keep the sample intat, I made a new Project and copy the sample code for a nice starting Point. Start this for test, but now I get the error 'Connection losed, unexpected error at receiving ..' The command window opens, the browser window opens, but ..
Now I can run the 'old' Version, works and the new Version, Fails. I don't run both at the same time but on the same machine ..
With best regads
Gerhard
Can you please tell which browser windows is getting opened ? Is it IE or Edge.
If it is edge , then we need to enable WebDriver in optional features in windows 10 settings.
I’m not sure if my comment will help, but trying my best.
Hi, it is Win 10 Pro & Edge, but I used the IE Driver, my fault. But the error message is misleading so also fault from MS or SeleniomHQ ..
But now it works.
When I try to create two dricer instances for Edge, it fails ...
With best regards
Gerhard
The Microsoft Edge driver does not support multiple simultaneous instances of Edge, if memory serves. One should note that the driver executable is developed and maintained by Microsoft, not the Selenium project, so discussions about disappointment with that driver’s behavior should be directed toward them. Please note, however, that there is extremely little (next to no) development effort being expended at Microsoft on either the currently shipping Edge driver (the one based on the EdgeHtml rendering engine) or its driver. Rather nearly all of their development effort is being directed toward their Chromium-based Edge browser and its driver.
Hi @GerhardKreuzer , JimEvans is one of the core contributers of selenium. From his comments we see that it’s not possible to have multiple instances of Edge.
Just wondering if you need just a new tab or really a new instance. If you don’t mind, can we know the reason why your test need two instances.
Hi, I don't write tests. I want to automate user interaction. So my idea was, to create an agent for each job, so I don't have to navigate between different jobs (pages). But I can also use another browser as far as is clear that the browser did't send data elswhere. Thats the reason, why I don't use Googe products if possible.
With best regards
Gerhard
Hi, ok, but if I can creat a new tab and start a new session herin, it may work out. How can I create a new session in a new tab on my instance of Edge?
With best regards
Gerhard
Hi, I don't write tests. I want to automate user interaction. So my idea was, to create an agent for each job, so I don't have to navigate between different jobs (pages). But I can also use another browser as far as is clear that the browser did't send data elswhere. Thats the reason, why I don't use Googe products if possible.
With best regards
Gerhard
Hi. I think you are left with a few options for choosing the browser, if you don't trust chrome, then you may choose IE11 or Firefox ?
Hi, ok, but if I can creat a new tab and start a new session herin, it may work out. How can I create a new session in a new tab on my instance of Edge?
With best regards
Gerhard
Hi @GerhardKreuzer , Please find below a working code snippet to get you started. I have not focused on design patterns or best practices / page objects etc.. as the objective of the snippet is to showcase just one of the ways of doing it..
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;
import java.util.ArrayList;
public class MyTest {
@Test
public void myTest() throws Exception {
WebDriver driver = new EdgeDriver();
driver.get("https://www.google.com.au");
createNewTabAndSwitchToIt(driver);
driver.get("https://www.duckduckgo.com");
switchToTabByTitle(driver,"Google");
driver.findElement(By.name("q")).sendKeys("apple");
driver.findElement(By.name("btnK")).submit();
switchToTabByTitle(driver,"DuckDuckGo");
driver.findElement(By.id("search_form_input_homepage")).sendKeys("orange");
driver.findElement(By.id("search_button_homepage")).submit();
}
private void createNewTabAndSwitchToIt(WebDriver driver)
{
// credits: https://stackoverflow.com/questions/23011836/how-to-open-a-new-tab-using-selenium-webdriver-and-start-the-link
((JavascriptExecutor)driver).executeScript("window.open('about:blank', '-blank')");
// To switch to the last tab
ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
driver.switchTo().window(tabs.get(tabs.size()-1));
}
private void switchToTabByTitle(WebDriver driver, String titlePartialText) throws Exception {
String tabHandleBeforeSwitch = driver.getWindowHandle();
ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
for(String tab : tabs)
{
driver.switchTo().window(tab);
if(driver.getTitle().contains(titlePartialText)){
return;
}
}
//switching back to tabHandleBeforeSwitch
driver.switchTo().window(tabHandleBeforeSwitch);
throw new Exception("Unable to find a tab title with partial text: "+ titlePartialText);
}
}
Thanks a lot, will give it a try tonight ... will post Report asap.
Hi @GerhardKreuzer , if your problem is resolved then you can close this defect. I also see this issue is a limitation of MicrosoftWebDriver and not a defect of Selenium in itself. https://github.com/SeleniumHQ/selenium/issues/4650.
Please send questions to the selenium user group, to StackOverflow, or in the IRC/Slack channel where the community can help you as well.
@GerhardKreuzer As mentioned above, this is not a support/help forum, it is a place to report bugs/issues. Please follow @rapidroamer's recommendation and send questions to those channels.
Hi, tried the sample here (https://www.seleniumhq.org/docs/03_webdriver.jsp#introducing-the-selenium-webdriver-api-by-example) but it reports that there is no element named 'q'.
I used the IE-Driver.
Thanks for helping
With best regards
Gerhard