c# selenium to browse and upload a file

后端 未结 2 1019
Happy的楠姐
Happy的楠姐 2021-01-12 17:57

In my selenium c# windows forms application, I have a scenario like uploading a doc/docx file. I have already done uploading in some another case.since it has some text box

2条回答
  •  渐次进展
    2021-01-12 18:47

    We can Not handle windows fileOpenDialog through Selenium. we have to use either Javascript executor but some time still it is not possible to use Javascriptexecutor. it won't execute. It gives null value error. Example :

    If you go to naukri.com on below link http://my.naukri.com/manager/createacc2.php?othersrcp=11499&wExp=N or

    
    

    to upload the file.

    your javascript and selenium wont identify the browse element.

    Then we have to use third party tool such as Point Position to compute x & Y coordinate of "browsefile" Button then, we can use C#.Net low level MouseClick handle to click on it or we can use AutoIt tool to handle wondows pop. To know more you can visit on

    http://avinashpandeblogsonseleniumautomation.blogspot.in/2015/06/upload-file-using-selenium-web-driver.html you will get solution with an example.

提交回复
热议问题