Close File Picker Dialog

rvmsengrvmseng Posts: 79
edited December 2018 in SOAtest

Dear Support team,

In web scenario after upload a file, File Picker Dialog not closed automatically and I need do "Keypress" action with "Escape" key, Unfortunately SOATest 9.10 doesn't have "Keypress" action (only have "keyup" and "keydown"). Pease share a solution for this issue. Also I tried "keyup" and "keydown" actions in SOATest, but both of them doesn't work with "Escape" key.

I searched about this issue in many forums and I found below solution but I don't know how can I use it in SOATest.

((RemoteWebDriver)driver).getKeyboard().pressKey(Keys.ESCAPE);

Comments

  • benken_parasoftbenken_parasoft Posts: 725 ✭✭✭
    edited December 2018

    In web scenario after upload a file, File Picker Dialog not closed automatically

    There are some notes about file input dialogs mentioned here: Browser Support

    However, you should be able to type a path into a file input field, similar to other form fields. Please see this other thread:
    How to attach a file in UI using SOAtest record and playback?

    I searched about this issue in many forums and I found below solution but I don't know how can I use it in SOATest.

    I don't believe you can directly access the RemoteWebDriver object used internally by SOAtest's Browser Playback tools. I'm not seeing anything about this in the user's guide.

  • tonytony Posts: 18

    As benken_parasoft mentioned above, file choosers should be handled automatically assuming you are using the Selenium WebDriver framework (double-click scenario, click "Browser Playback Options" tab, verify "Playback Engine" settings). However, it sounds like you are dealing with some kind of custom HTML component that will not hide unless sending an escape key. If that's correct, you can try sending an escape key using SOAtest's Execute JavaScript action. See this comment for details.

    The Execute JavaScript feature allows you to execute JavaScript directly within the context of the browser (similar to Selenium's executescript function). So you may use any features available within the browser's DOM to control functionality within your web application.

  • rvmsengrvmseng Posts: 79
    edited December 2018

    Thank you for your reply,

    Unfortunately your solution don't work and I attach a sample ".tst" file that include issue with close file picker dialog.

    How can I close file picker dialog?

  • tonytony Posts: 18
    edited December 2018

    You need to use a type action rather than a click action:
    1. Double-click "Test 2..."
    2. Under "User Action" change "Action" from "Click" to "Type"
    3. Under "Text Input" "Value" enter the absolute path to the file you wish to upload
    3. Under "Element Locator" "Element Name" enter "input"
    4. Under "Element Locator" "Attribute Name" enter "name"
    5. Under "Element Locator" "Attribute Value" enter "uploaded_file"
    6. Save the changes and play back.

    Also note the limitations listed under Browser Support in the documentation.

Sign In or Register to comment.