window-handles

C# Process.MainWindowHandle always returns IntPtr Zero

烂漫一生 提交于 2019-11-27 22:20:25
this is my code: using (Process game = Process.Start(new ProcessStartInfo() { FileName="DatabaseCheck.exe", RedirectStandardOutput = true, CreateNoWindow = true, UseShellExecute = false })) { lblLoad.Text = "Loading"; int Switch = 0; while (game.MainWindowHandle == IntPtr.Zero) { Switch++; if (Switch % 1000 == 0) { lblLoad.Text += "."; if (lblLoad.Text.Contains("....")) lblLoad.Text = "Loading."; lblLoad.Update(); game.Refresh(); } } Problem is, that game.MainWindowHandle is always IntPtr.Zero. I need to find the IntPtr of the ran process to confirm that the game was started by the launcher,

getWindowHandles() not working in firefox 58.The focus remains on parent tab and does not transfer to next tab

喜夏-厌秋 提交于 2019-11-26 23:20:07
I am starting to learn how to handle multiple tabs in a browser using Selenium with Java. looks like my code below is not working. import java.util.ArrayList; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class HandlingWindows { public static void main(String[] args) throws InterruptedException { WebDriver driver= new FirefoxDriver(); driver.get("https://www.facebook.com/"); String parent= driver.getWindowHandle(); System.out.println("Parent Window is"+parent); //Get Data

Selenium Switch Tabs

折月煮酒 提交于 2019-11-26 23:07:26
Since Firefox does not support Control + T anymore for the tab, I started using driver.execute_script("window.open('URL', 'new_window')") I am trying to display the title of the different tab I open and switch between them. For the example below, I expect the output to be facebook, google and back to facebook. Right now the output is facebook, facebook and facebook. I tried the answer from here but it also did not work: Switch back to parent tab using selenium webdriver from selenium import webdriver driver = webdriver.Firefox() driver.get("http://www.facebook.com/") print(driver.title) driver

How do I get the handle of a console application's window

元气小坏坏 提交于 2019-11-26 22:43:00
Can someone tell me how to get the handle of a Windows console application in C#? In a Windows Forms application, I would normally try this.Handle . Not sure it works, but you can try that : IntPtr handle = Process.GetCurrentProcess().MainWindowHandle; ivan_pozdeev The aforementioned Process.MainWindowHandle method only works for the process that started the console The FindWindowByCaption method is inherently unreliable Here's a robust way to do this: The related functions from the Console Win32 API are: [DllImport("kernel32.dll", SetLastError = true)] static extern bool AttachConsole(uint

Winforms issue - Error creating window handle [duplicate]

三世轮回 提交于 2019-11-26 18:44:10
This question already has an answer here: “Error Creating Window Handle” 8 answers We are seeing this error in a Winform application. Can anyone help on why you would see this error, and more importantly how to fix it or avoid it from happening. System.ComponentModel.Win32Exception: Error creating window handle. at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp) at System.Windows.Forms.Control.CreateHandle() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.OnVisibleChanged

Winforms issue - Error creating window handle [duplicate]

核能气质少年 提交于 2019-11-26 17:26:20
问题 This question already has an answer here: “Error Creating Window Handle” 8 answers We are seeing this error in a Winform application. Can anyone help on why you would see this error, and more importantly how to fix it or avoid it from happening. System.ComponentModel.Win32Exception: Error creating window handle. at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp) at System.Windows.Forms.Control.CreateHandle() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

getWindowHandles() not working in firefox 58.The focus remains on parent tab and does not transfer to next tab

耗尽温柔 提交于 2019-11-26 08:38:28
问题 I am starting to learn how to handle multiple tabs in a browser using Selenium with Java. looks like my code below is not working. import java.util.ArrayList; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class HandlingWindows { public static void main(String[] args) throws InterruptedException { WebDriver driver= new FirefoxDriver(); driver.get(\"https://www.facebook.com/\")

Selenium Switch Tabs

醉酒当歌 提交于 2019-11-26 08:37:16
问题 Since Firefox does not support Control + T anymore for the tab, I started using driver.execute_script(\"window.open(\'URL\', \'new_window\')\") I am trying to display the title of the different tab I open and switch between them. For the example below, I expect the output to be facebook, google and back to facebook. Right now the output is facebook, facebook and facebook. I tried the answer from here but it also did not work: Switch back to parent tab using selenium webdriver from selenium

Check if any alert exists using selenium with python

只愿长相守 提交于 2019-11-26 05:54:07
问题 I\'m trying to write a test with selenium in python language for a web page that manages users. In this page someone can add role for users and if a role exists while adding it, an alert raises. I don\'t know if the alert is a javascript alert or an element of the web page. I want to automatically check the existence of the alert, because checking for the role in the list wastes time and has an enormous load. I tried this: browser = webdriver.Firefox() browser.get(\"url\") browser.find_the

Best way to keep track and iterate through tabs and windows using WindowHandles using Selenium

半城伤御伤魂 提交于 2019-11-26 00:24:21
问题 We are working with Selenium webdriver to make UI tests for Internet Explorer 11. In the tested webapplication there are several screens popping up. In several tests we end up with three browserswindows, so also three Driver.WindowHandles. To switch from one WindowHandle to the other we expected that Driver.WindowHandles would be sorted like the oldest windows first and the newest windows last. But this is not the case: It is totaly random! Because a windowhandle is a GUID we ended up