Search Results

Search found 59 results on 3 pages for 'sendkeys'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • Webdriver: Tests crash with internet explorer7 with error Modal dialog present

    - by user1207450
    Following tests is automated by using java and selenium-server-standalone-2.20.0.jar. The test crashes with the error: Page title is: cheese! - Google Search Starting browserTest 2922 [main] INFO org.apache.http.impl.client.DefaultHttpClient - I/O exception (org.apache.http.NoHttpResponseException) caught when processing request: The target server failed to respond 2922 [main] INFO org.apache.http.impl.client.DefaultHttpClient - Retrying request Exception in thread "main" org.openqa.selenium.UnhandledAlertException: Modal dialog present (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 1.20 seconds Build info: version: '2.20.0', revision: '16008', time: '2012-02-27 19:03:04' System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_24' Driver info: driver.version: InternetExplorerDriver at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:170) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:129) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:438) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:139) at org.openqa.selenium.ie.InternetExplorerDriver.setup(InternetExplorerDriver.java:91) at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:48) at com.pwc.test.java.InternetExplorer7.browserTest(InternetExplorer7.java:34) at com.pwc.test.java.InternetExplorer7.main(InternetExplorer7.java:27) Test Class: package com.pwc.test.java; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriverBackedSelenium; import org.openqa.selenium.WebElement; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import org.openqa.selenium.ie.InternetExplorerDriver; import com.thoughtworks.selenium.Selenium; public class InternetExplorer7 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub WebDriver webDriver = new HtmlUnitDriver(); webDriver.get("http://www.google.com"); WebElement webElement = webDriver.findElement(By.name("q")); webElement.sendKeys("cheese!"); webElement.submit(); System.out.println("Page title is: "+webDriver.getTitle()); browserTest(); } public static void browserTest() { System.out.println("Starting browserTest"); String baseURL = "http://www.mail.yahoo.com"; WebDriver driver = new InternetExplorerDriver(); driver.get(baseURL); Selenium selenium = new WebDriverBackedSelenium(driver, baseURL); selenium.windowMaximize(); WebElement username = driver.findElement(By.id("username")); WebElement password = driver.findElement(By.id("passwd")); WebElement signInButton = driver.findElement(By.id(".save")); username.sendKeys("myusername"); password.sendKeys("magic"); signInButton.click(); driver.close(); } } I don't see any modal dialog when I launched the IE7/8 browser manually. What could be causing this?

    Read the article

  • vb.net press/release keys

    - by Cyclone
    How can you simulate keypresses and releases? I know you can essentially hit a key with Sendkeys.SendWait, but how can your code press and hold q, for example? Any help is much appreciated! Everything I find keeps pointing me at sendkeys, which is not correct. I essentially wish to be able to call something like press("q") and release("q"). The effect would be the same as physically holding them down. Thanks for your help!

    Read the article

  • How to append \line into RTF using RichTextBox control

    - by Steve Sheldon
    When using the Microsoft RichTextBox control it is possible to add new lines like this... richtextbox.AppendText(System.Environment.NewLine); // appends \r\n However, if you now view the generated rtf the \r\n characters are converted to \par not \line How do I insert a \line control code into the generated RTF? What does't work: Token Replacement Hacks like inserting a token at the end of the string and then replacing it after the fact, so something like this: string text = "my text"; text = text.Replace("||" "|"); // replace any '|' chars with a double '||' so they aren't confused in the output. text = text.Replace("\r\n", "_|0|_"); // replace \r\n with a placeholder of |0| richtextbox.AppendText(text); string rtf = richtextbox.Rtf; rtf.Replace("_|0|_", "\\line"); // replace placeholder with \line rtf.Replace("||", "|"); // set back any || chars to | This almost worked, it breaks down if you have to support right to left text as the right to left control sequence always ends up in the middle of the placeholder. Sending Key Messages public void AppendNewLine() { Keys[] keys = new Keys[] {Keys.Shift, Keys.Return}; SendKeys(keys); } private void SendKeys(Keys[] keys) { foreach(Keys key in keys) { SendKeyDown(key); } } private void SendKeyDown(Keys key) { user32.SendMessage(this.Handle, Messages.WM_KEYDOWN, (int)key, 0); } private void SendKeyUp(Keys key) { user32.SendMessage(this.Handle, Messages.WM_KEYUP, (int)key, 0); } This also ends up being converted to a \par Is there a way to post a messaged directly to the msftedit control to insert a control character? I am totally stumped, any ideas guys? Thanks for your help!

    Read the article

  • UI Automation in Citrix

    - by aceinthehole
    I would like to be able to use a tool like WatiN to automate somethings that needs to interact with a Web App that is access by using an instance of IE running on Citrix. So far it seems impossible to interact with the window at even a rudimentary level using SendKeys as the internal UI components seemingly do not have a handle. Has anyone been able to do this or anything similar?

    Read the article

  • Simulating Key Press event using Python for Linux

    - by user308827
    Hi, I am writing a script to automate running a particular model. When the model fails, it waits for a user input (Enter key). I can detect when the model has failed, but I am not able to use python (on linux) to simulate a key press event. Windows has the SendKeys library to do this but I was wondering if there is a similar library for python on linux. Thanks!

    Read the article

  • Selenium WebDriver Element

    - by cxyz
    How do i configure selenium WebDriver.I have automated test cases using Selenium.Now i need to automate upload and download of a file.So i have to automate using WebDriver.I had added webdriver-common-0.9.7376.jar.Now how do i instantiate for Internet Explorer? Am just decalring variable and using driver private static WebDriver driver; driver.findElement(By.id(upload)).sendKeys("file to be upload"); Is this correct?

    Read the article

  • How to refresh a webpage in IE

    - by Ramesh
    HI all, I have Ishare URL " www.example.com\ishare " which i opened it thru wshshell. I want this page to be reloaded every 10 seconds. any help on this would be much appreciated. following is the script, Dim WSHShell Dim oShell Set WSHShell = WScript.CreateObject("WScript.Shell") WSHShell.Run("iexplore https://Infrastructure/IA/Lists/Incidents/AllItems.aspx") oShell = "Incidents - Microsoft Internet Explorer" WSHShell.appActivate(oShell) WScript.sleep 500 WSHShell.SendKeys "{F5}" Set WSHShell = Nothing

    Read the article

  • How can I click through an alert box with a VBScript automating IE?

    - by DeliriumTremens
    I have a VBScript that is running through a list of actions in IE, and at one point the site displays an Alert box with "OK" and "Cancel" as options. 'OK' is focused when the alert box appears, however SendKeys "{ENTER}" isn't doing the trick. I think perhaps the browser window still has the focus of the VBS. How can I tell the VBS to 'OK' the alert box and continue with the routines?

    Read the article

  • Detecting Enter KeyPress on VB.NET 2008

    - by Tareq
    I am using 3.5 framework of VB.NET 2008. I have some textboxes in my form. I want the tab like behavior when my user presses ENTER on one of my textboxes. I used the following Code: Private Sub txtDiscount_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtDiscount.KeyPress If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then SendKeys.Send("{TAB}") e.Handled = True End If End Sub But It doen't work for me. Please give me a solution.

    Read the article

  • windows form applications' cut copy paste functionality

    - by Muhammad Adnan
    I have windows forms application with multiple forms and controls in them. I want if user has selected some text in any control of any form of my application and click on cut/copy/paste button on toolbar operation get performed accordingly. i m using C#.net's sendkeys.send("^c") on click of copy button but it doesn't work... OR any 1 can tell if is there any way to get selected text (despite of knowing, which form/control of my application). Thanks in advance...

    Read the article

  • Change the key being pressed with C#

    - by Benny
    Hey, I'm trying to write a program in C# that will track the pressing of certain keys (using a keyboard hook), and send different ones instead. For instance, when I press the A key it will instead send the Q key. I used http://www.codeproject.com/KB/cs/CSLLKeyboardHook.aspx this for my hooks and tried to use the SendKeys function, but I get an exception about the garbage collector destroying some object inside the hook class.

    Read the article

  • Multiple desktops in Windows

    - by John Straka
    I'm running a program that uses WatiN to automate file uploads to different websites. I currently run it on a machine that I remote into via the standard Remote Desktop Connection in Windows - once I start an upload, I go ahead and continue using my local machine. Soon, I'll be needing to run it locally. The problem is that it requires focus (which is unavoidable due to WatiN utilizing SendKeys) and I of course don't want to render my machine useless while it runs. So, my question: Is there any way to emulate the multiple desktops/workspaces that have been in many Linux distros for some time? I tried VirtuaWin to no avail. Alternatively, is there a way to remote into a machine from itself? Or is there some other means of creating a separate session on the same machine that does not steal focus? Running Linux is not an option, and a VM would be overkill.

    Read the article

  • Webdriver PageObject Implementation using PageFactory in Java

    - by kamal
    here is what i have so far: A working Webdriver based Java class, which logs-in to the application and goes to a Home page: import java.io.File; import java.io.IOException; import java.util.concurrent.TimeUnit; import org.apache.commons.io.FileUtils; import org.openqa.selenium.By; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxProfile; import org.testng.AssertJUnit; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class MLoginFFTest { private WebDriver driver; private String baseUrl; private String fileName = "screenshot.png"; @BeforeMethod public void setUp() throws Exception { FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("network.http.phishy-userpass-length", 255); profile.setAssumeUntrustedCertificateIssuer(false); driver = new FirefoxDriver(profile); baseUrl = "https://a.b.c.d/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public void testAccountLogin() throws Exception { driver.get(baseUrl + "web/certLogon.jsp"); driver.findElement(By.name("logonName")).clear(); AssertJUnit.assertEquals(driver.findElement(By.name("logonName")) .getTagName(), "input"); AssertJUnit.assertEquals(driver.getTitle(), "DA Logon"); driver.findElement(By.name("logonName")).sendKeys("username"); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("password")).sendKeys("password"); driver.findElement(By.name("submit")).click(); driver.findElement(By.linkText("Account")).click(); AssertJUnit.assertEquals(driver.getTitle(), "View Account"); } @AfterMethod public void tearDown() throws Exception { File screenshot = ((TakesScreenshot) driver) .getScreenshotAs(OutputType.FILE); try { FileUtils.copyFile(screenshot, new File(fileName)); } catch (IOException e) { e.printStackTrace(); } driver.quit(); } } Now as we see there are 2 pages: 1. Login page, where i have to enter username and password, and homepage, where i would be taken, once the authentication succeeds. Now i want to implement this as PageObjects using Pagefactory: so i have : package com.example.pageobjects; import static com.example.setup.SeleniumDriver.getDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.FluentWait; import org.openqa.selenium.support.ui.Wait; public abstract class MPage<T> { private static final String BASE_URL = "https://a.b.c.d/"; private static final int LOAD_TIMEOUT = 30; private static final int REFRESH_RATE = 2; public T openPage(Class<T> clazz) { T page = PageFactory.initElements(getDriver(), clazz); getDriver().get(BASE_URL + getPageUrl()); ExpectedCondition pageLoadCondition = ((MPage) page).getPageLoadCondition(); waitForPageToLoad(pageLoadCondition); return page; } private void waitForPageToLoad(ExpectedCondition pageLoadCondition) { Wait wait = new FluentWait(getDriver()) .withTimeout(LOAD_TIMEOUT, TimeUnit.SECONDS) .pollingEvery(REFRESH_RATE, TimeUnit.SECONDS); wait.until(pageLoadCondition); } /** * Provides condition when page can be considered as fully loaded. * * @return */ protected abstract ExpectedCondition getPageLoadCondition(); /** * Provides page relative URL/ * * @return */ public abstract String getPageUrl(); } And for login Page not sure how i would implement that, as well as the Test, which would call these pages.

    Read the article

  • Automate open dialog in C#? (From COM OCX)

    - by JL
    I have a COM OCX control that I need to automate. It has a method called Open() this method is called without parameters, and always displays an open file dialog (standard one with windows). Is there a way for me to somehow get the file open dialog to open a file I specify , then close the dialog? I would also not like to use sendkeys or any other variants, because I require the solution to be reliable. So ideally would like to grab a handle on that window, and set the file name programatically, and then execute the open method programatically. Thanks in advance.

    Read the article

  • How to properly close a process with NppExec?

    - by Sam the Great
    I'm not sure what's going on here, but the following code continues running even after I end the process in the NppExec console with Ctrl-C (during the execution of the while loop). I restarted my computer to stop the Ctrl key sends. However, if I run the script in Window's cmd prompt, Ctrl-C ends the script just fine. import time import win32com.client shell = win32com.client.Dispatch("WScript.Shell") time.sleep(2) while True: shell.SendKeys('^') # Ctrl key time.sleep(0.5) The NppExec run command I used was: cmd /C python -u "$(FULL_CURRENT_PATH)" Let me know if there is any more information I can provide. Thanks.

    Read the article

  • Generating Mouse-Keyboard combination events in python

    - by freakazo
    I want to be able to do a combination of keypresses and mouseclicks simultaneously, as in for example Control+LeftClick At the moment I am able to do Control and then a left click with the following code: import win32com, win32api, win32con def CopyBox( x, y): time.sleep(.2) wsh = win32com.client.Dispatch("WScript.Shell") wsh.SendKeys("^") win32api.SetCursorPos((x,y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0) What this does is press control on the keyboard, then it clicks. I need it to keep the controll pressed longer and return while it's still pressed to continue running the code. Is there a maybe lower level way of saying press the key and then later in the code tell it to lift up the key such as like what the mouse is doing?

    Read the article

  • Send Keyboard Input to VMWare from C#

    - by Robert
    Hi. I want to send mouse clicks and keyboards keys to a window running a virtual machine such as VMware or VirtualBox. I want to pilotate it from the host OS, from an application written in C#. I can move and click the mouse. But I can't send keyboard input. I tried with SendKeys but it doesn't work. With every other "normal" window, it works. But I think it's related to how VMware or Virtual BOx intercept keyboard events. Any idea?

    Read the article

  • How to print the Control identifiers of a window to a document in Pywinauto.

    - by Swetha
    Hi All, I am trying to automate installation of an application using Pywinauto.During the installation the last window shows some warning or error messages in few cases and later the system begins to restart.My objective is to capture the the Warning messages which is possible by app.top_window_()._ctrl_identifiers() np.Notepad.Edit.TypeKeys(a,with_spaces=True, with_tabs=True, with_newlines=True) This is returning a list which contains all the messages of the screen. Second line is where i am trying to print the list object in the notepad.But its throwing some exceptions Traceback (most recent call last): File "", line 1, in np.Notepad.Edit.TypeKeys(a,with_spaces=True, with_tabs=True, with_newlines=True) File "C:\Python26\pywinauto\controls\HwndWrapper.py", line 950, in TypeKeys turn_off_numlock) File "C:\Python26\pywinauto\SendKeysCtypes.py", line 629, in SendKeys keys = parse_keys(keys, with_spaces, with_tabs, with_newlines) File "C:\Python26\pywinauto\SendKeysCtypes.py", line 538, in parse_keys c = string[index] KeyError: 0 Could anyone let me know how to do this or if there is other way in which this can be handled with an example. Thanks a lot in advance. Swetha

    Read the article

  • Rotate view of PDF on a WinForm

    - by Dabas
    I have to display a PDF inside a winform (c# on .net 2.0 framework). For now, I am using the ActiveX PDF control provided by Adobe. I have to disable the entire control so that a user can't print or save via right-click or hotkeys. Unfortunately, many of the documents need to be rotated (just viewed, not permanently saved that way). I'd like to allow them to rotate the view by pressing a button control. I've tried enabling the control then programmatically sending the hotkeys (ctrl shift +) using SendKeys and SendInput but the timing issues make this a non-viable solution. I've asked on the proper Adobe boards and they said it was not possible being that all of my clients will only have the reader version installed.

    Read the article

  • how does selenium webdriver upload files to the browser?

    - by justspamjustin
    I am a javascript/java developer and I have been trying to figure out how the selenium webdriver automation framework uploads files from the file system. It is impossible to set a file input via javascript because it is a security violation. Yet somehow webdriver is able to do this with the following command: driver.setFileDetector(new LocalFileDetector()); WebElement upload = driver.findElement(By.id("myfile")); upload.sendKeys("/Users/sso/the/local/path/to/darkbulb.jpg"); driver.findElement(By.id("submit")).click(); So they are setting the value by sending keys to it? I don't get it. I have looked through the source code found here: http://code.google.com/p/selenium/source/checkout I am still not able to find where they do this. Edit: My question is not how to do this with selenium, but how did the selenium developers make this possible? How did they get around the security restrictions in javascript? How are they uploading the file?

    Read the article

  • Using Excel VBA to send emails. Problem with attachments becoming embedded by accident.

    - by Alexei
    Hi, I am having an issue with an Excel macro I wrote that is used by several users within my company. It is used to send numerous emails daily with attachments that are also Excel workbooks. The issue is that sometimes, instead of the file simply being attached as it should be, it becomes an embedded object. This embedded object is openable by users on the email within the company (after clicking through the "YOu are about to activate an embedded object that may contain viruses or be otherwise harmful to your computer. It is important to be certain that it is from a trustworthy source. Do you want to continue?"), but those outside of the company do not see it at all. The email appears to have no attachment at all. Curiously, this appears to happen randomly, and only on some computers. So if the list has 15 email lists and attachments, it seems to happen randomly to anywhere between 0 and 15 of the emails. To be clear, my objective is to send emails with regular attachments. Running Excel 2003, Outlook 2003, and Windows XP. See code below. Please help! Sub Email() Dim P As String Dim N As String Dim M As String Dim Subject As String Dim Addresses As String Dim olApp As Outlook.Application Dim olNewMail As Outlook.MailItem Application.DisplayAlerts = False M = ActiveWorkbook.Name For c = 2 To 64000 If Range("B" & c) = "" Then Exit For If UCase(Range("E" & c)) = "Y" Then Workbooks(M).Sheets("Main").Activate Subject = Range("A" & c) Addresses = Range("B" & c) P = Range("C" & c) N = Range("D" & c) If Right(P, 1) <> "\" Then P = P & "\" If Right(N, 4) <> ".xls" Then N = N & ".xls" Set olApp = New Outlook.Application Set olNewMail = olApp.CreateItem(olMailItem) With olNewMail .Display .Recipients.Add Addresses Application.Wait (Now + TimeValue("0:00:01")) SendKeys ("{TAB}") .Subject = Subject .Attachments.Add P + N .Send End With Set olNewMail = Nothing Set olApp = Nothing End If Next c Range("E2:E65536").ClearContents Application.DisplayAlerts = True End Sub

    Read the article

  • driver.findElement() with iframe and elements without ID

    - by user1864657
    Java Code: driver.switchTo().frame(0); WebElement elemText = driver.findElement(By.xpath("/html/body[contains(@class='forum')]")); //WebElement elemText = driver.findElement(By.xpath("//td[@id='cke_contents_vB_Editor_001_editor']/textarea")); elemText.sendKeys(message); elemText.submit(); forumLink = driver.getCurrentUrl(); HTML Code: <td id="cke_contents_vB_Editor_001_editor" class="cke_contents" style="height:1726px" role="presentation"> <iframe style="width:100%;height:100%" frameborder="0" title="Rich text editor, vB_Editor_001_editor, press ALT 0 for help." src="" tabindex="-1" allowtransparency="true"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html dir="ltr" lang="en" contenteditable="true"> <head> <title data-cke-title="Rich text editor, vB_Editor_001_editor, press ALT 0 for help.">Rich text editor, vB_Editor_001_editor, press ALT 0 for help.</title> <base href="http://fairplay.garena.com/" data-cke-temp="1"> <link type="text/css" rel="stylesheet" href="http://fairplay.garena.com/clientscript/vbulletin_css/style00008l/editor_contents.css"> <style type="text/css" data-cke-temp="1"> form{border: 1px dotted #FF0000;padding: 2px;} img.cke_hidden{background-image: url(http://fairplay.garena.com/clientscript/ckeditor/plugins/forms/images/hiddenfield.gif?t=B37D54V);background-position: center center;background-repeat: no-repeat;border: 1px solid #a9a9a9;width: 16px !important;height: 16px !important;} img.cke_iframe{background-image: url(http://fairplay.garena.com/clientscript/ckeditor/plugins/iframe/images/placeholder.png?t=B37D54V);background-position: center center;background-repeat: no-repeat;border: 1px solid #a9a9a9;width: 80px;height: 80px;} img.cke_anchor{background-image: url(http://fairplay.garena.com/clientscript/ckeplugins/vblink/images/anchor.gif?t=B37D54V);background-position: center center;background-repeat: no-repeat;border: 1px solid #a9a9a9;width: 18px !important;height: 18px !important;} a.cke_anchor{background-image: url(http://fairplay.garena.com/clientscript/ckeplugins/vblink/images/anchor.gif?t=B37D54V);background-position: left center;background-repeat: no-repeat;border: 1px solid #a9a9a9;padding-left: 18px;} </style> </head> <body class="forum" spellcheck="true"> </body> </html> </iframe> </td> Image: http://s9.postimage.org/nwyvq3san/Screen_Shot038.jpg I can't find a way to get elements inside a iframe and without id. Can you help me?

    Read the article

< Previous Page | 1 2 3  | Next Page >