I want to active ime and input chinese.
How to trigger compositionStart, compositionUpdate,compositionEnd.
I use this.remote.type([]) method, but not trigger text input events.
Thanks.
The IME must be activated independently, just like on the real OS, before type commands will be processed through it. Unfortunately, the underlying WebDriver library used by Intern does not currently implement IME activation. Once it does, you will be able to activate and test IMEs with Intern.
It's very easy to add new methods to wd. There is a guide at the end of the README: https://github.com/admc/wd#adding-new-method--contributing
Once it is done just, open a pull request and that will go into the npm package pretty quickly. This is how most of the existing methods were added to wd.
Related
I want to use Blockly to do some calculations, and then generate text files (as opposed to exporting code to JavaScript, Python, PHP, etc.)
I can’t see an obvious way to create my own blocks to do this in Blockly, so using AppInventor (Version: nb168), I got storing and retrieving files to work, in a crude test app on my Android tablet.
In AppInventor/Designer mode, clicking Storage/File creates a “Non-visible component for storing and retrieving files. Use this component to write or read files on your device.”
Then, in AppInventor/Blocks mode, clicking the “File1” icon gives access to 7 “file type blocks”, e.g. AppendToFile, Delete, ReadFrom, SaveFile, etc.
Is it possible to create similar “file type blocks” to use in Blockly Web?
I have limited programming knowledge, so would appreciate simple answers, please.
Thanks, Pete.
Andrew N Marshall from Google/Blockly has told me this:
"This is absolutely possible ...as long as you willing to work within the browser's security restrictions. The resulting files will be need to be manually "downloaded" one at a time, rather than written directly to the user's file system.
... I would start understanding what JavaScript functions are available to you. Attempt to construct a string and save it via a download dialog...
That means the "file" contents are really just a string in memory, a JavaScript variable. We have lots of "Text" blocks that can do a variety of operations on strings. If those are enough, you'll only need one new block to identify the string variable and initiate the download process.
Otherwise, you'll need to think about what blocks you want, and how they operate. They may operate on a specific variable in the JavaScript VM, not necessary exposed as a variable to Blockly.
Either way, you'll need to learn how to create a block and a Blockly app. We have a code lab that will walk you through all the steps. You'll learn how each block generates a string of code, and in your case, that code will be related to the download code I mentioned earlier."
So I'll press on - I just wanted to be sure my goal is actually achievable before I started.
Thanks, Pete.
I want to show a specified dialog under simulation category like "Developement Strategy" and do something after its "OK" click. Is there a way to show a native petrel process window?
I can see some class and interfaces in "Slb.Ocean.Petrel.UI" like DialogBuilder , DialogPage, IDialogPageFactory, IDialogPage...but I can't use them, even I don't know if they supply my required objects.
I think you want to create a Workstep (Slb.Ocean.Petrel.Workflow). The Ocean wizard lets offers a quick start. It creates optionally a process wrapper for you, which is the item showing up in the process tree.
Once you got familiar with the concepts, you can evolve the simplistic initial implementation by using the WorkflowEditorUIFactory. Check the namespace documentation in the Ocean documentation for more details.
IProcessDiagram offers different Add methods for your custom Process to enable custom positioning in the tree node sequence.
You can programmatically show a particular process dialog using DialogBuilder.ShowSettings(object) and passing the Process instance. This is typically used by a plug-in to launch its own process dialog, but it's possible to obtain a reference to the instance of a native Process by name using FindProcess(string). This is, of course, a very fragile approach:
Process p = PetrelSystem.ProcessDiagram.FindProcess("Development strategy");
PetrelSystem.DialogBuilder.ShowSettings(p);
It would need a lot of error handling, not just to guard against changes to the process name, but also to handle the case where an exclusive process dialog is already open.
However, this will still only launch the dialog. There is no way to know if/when the user clicks the OK button. Petrel processes are typically stand-alone pieces of functionality, and any kind of chaining is generally supported by creating workflows.
I am working on a language service and would like the parsing after the user types code to be faster.
Right now I rely on the ParseReason.Check and OnIdle mechanism that's documented on MSDN, but its often called a long time after the user has typed code. Sometimes it helps to move the cursor to another line to trigger it faster.
What I'd like to do is to force parse the file after I detect the user has typed in the file. I'm able to detect when the user is typing, but I don't know how to trigger the parser with a ParseRequest.
I was running into a similar problem, I wanted to scan files not opened in VS. The best I could do was to abstract out my parse functionality so it gets called by VS, but also called by another internal function to my extension whenever I desired without going through VS, and this would store my parse results to the same structures as the direct VS call on ParseRequest.
I'd be curious to know if you find a better way of doing it though.
You could try calling BeginParse() on your Source implementation. That creates a ParseRequest with the Check parse reason. I turned off the OnIdle timer in my language service and tested it out and it appears to work.
If your code that detects user key-presses has access to an instance of your LanguageService implementation, then you can use service.GetSource(...).BeginParse(). If it has access to the Source itself, then it's even easier.
i need some help related to masked field in web form. Syntax of phone field is (___)___-_____, if i execute this code in ruby shell
browser.text_field(:id => 'txtphone').set '7893457889'
... nothing has been added in the phone field.
then i find this solution in one blog, someone said first unmask this field using this code.
browser.text_field(:id,'txtphone').fire_event("unmask")
then write the above code again.
browser.text_field(:id => 'txtphone').set '7893457889'
but still nothing has happened. kindly help me out...am i doing right or still there is a mistake.
If you could provide some sample of the page HTML it will be easier to give you an answer more likely to work.
Given what you have provided us to work from, we have to go with the normal way that such masked input fields typically work and go from there. Usually pages with this kind of thing are calling a javascript function which is triggered by a specific event. Most often this is an event such as onchange but it may be something like keypress or any other even that happens when a normal user types or pasts text into the cell.
You likely need to experiment with using the '.fire_event' method to fire the proper javascript event, or if that fails entirely making a direct call to execute the proper script
When doing this do not confuse the name of a script such as 'applymask' or somesuch with the javascript event which causes that script to be invoked.
The answers to this question How to find out which JavaScript events fired? include some good information on how to use firebug or the chrome developer tools to figure out what events are being fired when you interact with an object on the browser screen.
Update: instead of responding here to indicate if this answer was of any use the OP reposted their question here Masked Text Box issue and by digging around on the vendor's demo site (since that time he actually had posted some of the HTML when we asked for it) I was able to find a solution using watir-webdriver that worked for him.
Is there a way to get some help from RubyMine's code completion when using Capybara in Cucumber's step definitions? I'm new to Capybara, so not having to check the reference site all the time would be really helpful.
The best I can get at the moment is by explicitly calling Session.new, something like:
session = Capybara::Session.new(:rack_test, my_app)
This way Ctrl+Space after session. shows me methods from Capybara::Session (only) so at least I know it's somehow reachable. But that's not how I really use Capybara in my step definitions. I thought that helping the type inference engine by manually annotating page could do the trick, but I suppose all this DSL magic is too much to handle.
So basically, is it somehow possible to have
page.<Ctrl+Space>
pop up with all the exposed DSL methods? RubyMine API maybe? Or, as an alternative, some other way to bring the reference docs closer (I don't think RubyMine supports external docs in the IDE yet)?
As of RubyMine 8.0.3 the answer is no, RubyMine does not complete Capybara methods following page. in Cucumber step definitions, at least not when Capybara is included in Cucumber via the cucumber-rails gem. I don't see a feature request in the RubyMine issue tracker; someone could add one if they like.
Note that cucumber-rails, at least, includes the Capybara DSL in the Cucumber world, so you don't need to type page. in front of Capybara methods. You can just call visit, fill_in, etc. as self methods. I wouldn't want unnecessary page. in my step definitions just for the sake of RubyMine completion.
Unfortunately, RubyMine also doesn't include Capybara methods in the list of names it completes when you invoke completion in a step definition before you type anything. It does include Capybara methods in the list of names it completes when you invoke completion twice (all names in all available code), but since that list is so long it's only helpful if you already know the method you want already, or at least a correct prefix.
Finally, found a solution.
I am using Cucumber with Capybara and I included all the matchers I wanted to code complete in /features/support/spec/spec_helper.rb. Cucumber auto-loads everything in this file. I bet there are other places you can include these statements if you aren't using cucumber.
# Needed for RubyMine code completion
include Capybara::Node::DocumentMatchers
include Capybara::Node::Matchers
include Capybara::SessionMatchers
include Capybara::RSpecMatchers
include Capybara::RSpecMatcherProxies
For your specific case:
include Capybara::DSL
Then