开发者

Launching a website from within a program, and inputting data to specific fields

开发者 https://www.devze.com 2023-01-14 00:29 出处:网络
Although I\'ve been programming for a few years I\'ve only really dabbled in the web side of things, it\'s been more application based for computers up until now. I was wondering, in java for example,

Although I've been programming for a few years I've only really dabbled in the web side of things, it's been more application based for computers up until now. I was wondering, in java for example, what library defined function or self defined function I would use to have a program launch a web browser to a certain site? Also as an extension to this how could I have it find a certain field in the website like a search box for instance (if it wasnt the current target of the cu开发者_开发知识库rsor) and then populate it with a string and submit it to the server? (maybe this is a kind of find by ID scenario?!)

Also, is there a way to control whethere this is visible or not to the user. What I mean is, if I want to do something as a background task whilst the user carries on using the program, I will want the program to be submitting data to a webpage without the whole visual side of things that would interrupt the user?

This may be basic but like I say, I've never tried my hand at it so perhaps if someone could just provide some rough code outlines I'd really appreciate it.

Many thanks


I think Selenium might be what you are looking for.

Selenium allows you to start a Web browser, launch it to a certain website and interact with it. Also, there is a Java API (and a lot of other languages, by the way) allowing you to control the launched browser from a Java application.

There are some tweaking to do, but you can also launch Selenium in background, using a headless Web browser.


as i understand it you want to submit data to a server via the excisting webinterface?

in that case you need to find out how the URL for the request is build and then make a http-call using the corresponding URL

i advice reading this if it involves a POST submit

0

精彩评论

暂无评论...
验证码 换一张
取 消