I'm trying to retrieve some information from Gmail but have been unsuccessful after many attempts. This is the line of code that I'm trying to extract using javascript.
Inbox (182)
Im trying to get the text "Inbox (182)," to do that, I'm using this piece of code
NSString *js_result = [webview1 stringByEvaluatingJavaScriptFromString:#"document.getElementsByClassName('J-Ke n0').innerText"];
This however does not work, my result being nothing at all, and I've tried many alternatives but none have worked. All I need to do here is extract the "Inbox (182)" text in any way possible. Thanks.
I think your javascript is incorrect, since there are multiple elements with that class. If I login to gmail, this works:
document.getElementsByClassName('J-Ke n0')[0].innerText
I would be weary of using this in a production environment, though. It seems very brittle; that class or order of elements could be changed by Google at any time.
You also need to make sure that the page has loaded before trying to execute javascript. Typically this is implemented in a webViewDidFinishLoad: callback. If you're not getting a result and your JS is valid, this is probably the issue.
Related
I want to obfuscate a entire page html or some specific JavaScript(which changes every minute), because lot of people are grabbing my html page and extracting a specific part of my JavaScript and using it.
I tried Dean Adward Packer http://joliclic.free.fr/php/javascript-packer/en/
But it still shows few things that are not to be extracted.
For Example: If i give this input with php.
var
abc="aaaaaaa=1111111111111&bbbbbb=2222222222222&ccccccc=33333333333333";
It is giving a following output
eval(function(p,a,c,k,e,d){e=function(c){return
c};if(!''.replace(/^/,String)){while(c--){d[c]=k[c]||c}k=[function(e){return
d[e]}];e=function(){return'\w+'};c=1};while(c--){if(k[c]){p=p.replace(new
RegExp('\b'+e(c)+'\b','g'),k[c])}}return p}('7
6="5=4&3=2&1=0";',8,8,'33333333333333|ccccccc|2222222222222|bbbbbb|1111111111111|aaaaaaa|abc|var'.split('|'),0,{}))
Here, anyone can observe all the values and extract using php code.
I am aware of some online obfuscators like SmartGB, JSFuck and Javasciptobfuscator.
These tools are perfect for my case, but i am not able use them on server side.
I also know that, all above obfuscations can be easily cracked, But there is no use of cracking it once. Because, a variable of JavaScript keeps on changing every time.
All i want to do here is preventing people from automatically extracting a variable value with a simple machine code on their webserver. But manually, we cant prevent anything as javascript is public.
I am writing an application to list or update users using Javascript. I have enabled the relevant API's in dev console. This all works ok if I use AdminDirectory.Users.list, however when I try to get a single user via AdminDirectory.Users.get and pass the google ID as the key, I get Login Required.
I have tried to add option .viewType = "domain_public" but to no avail.
For now, Im going to re-write the local function that uses .get to get the user via list, but would like to know if anyone else has this problem or know how to fix it.
I ran into the same issue when I tried to write a custom function to retrieve the users in our directory. After reading Paul's comment, I checked and found that custom functions operate with same minimal permissions, so I also added a custom menu to load the users.
At risk of giving advice without testing it myself: for triggers, you'll need to use an event with an authMode value of FULL.
See the Google Apps Script Event Objects guide.
I am currently working on a HTML presentation, that works well, but I need the presentation to be followed simultaneously with a NAO robot who reads a special html tag. I somehow need to let him know, which slide I am on, so that he can choose the correct tag.
I use Beautiful Soup for scraping the HTML, but it does so from a file and not from a browser. The problem is, there is javascript running behind, assigning various classes to specific slides, that tell the current state of the presentation. And I need to be able to access those, but in the default state of the presentation they are not present and are added asynchronously throughout the process of the presentation.
Hopefully, my request is clear.
Thank you for your time
http://www.seleniumhq.org/ (probably webdriver) is your friend. Initialize a browser and call browser.html to get the document in the current state.
There's wget on the robot, you could use it... (though I'm not sure I understand where is really the problem...)
I can't find a simple answer to this anywhere on the web.
What i'm trying to do is running c# code when ever i click a certain HTML button with
onclick="<%MethodName()%>"
that will collect data from a database and present it on html tags.
Static methods are the only kind i currently know how to use, and never had to deal with one that needs to use SQL as well.
Problem is, i can't use most of the commands i need to use in a standard static method, nor will it recognize html tags and System.Data variables.
I could however run the code on Page_Load but i don't understand why would i do that if there's a possibility i'm never gonna need to use that information.
If anyone could supply me with an answer on how to use these type of commands in static methods (or show me a better way) that would be spectacular! Thanks in advance!
I'm working on an code editor using blockly, and my page currently has tabs for switching between Block View and Code View, kinda like some WYSIWYG editors. Now, Blockly already has plenty of stuff for going from blocks to code, and I've gotten 99% of the parts done so that I can go from code to blocks (it involves building up a bunch of block xml). My call to go from code view to block view looks like this:
var xml = Blockly.Xml.textToDom(self.xmlGenerated());
Blockly.mainWorkspace.clear();
Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, xml);
The problem is, no matter what id attributes I set in my xml nodes, blockly overrides them when I try to read the block xml later. It seems they constantly increment, even though I'm clearing the workspace. This causes a problem for my auto-save feature since that means each time I go from code to blocks my xml is changing, and therefore my code is changing (the generated code is a graph structure that also uses the id fields to identity each node in the graph).
So, my question is, does anyone know how to prevent Blockly from overriding the node id I send, or is there a way to "reset" the node ids?
I asked a very similar question in the Blockly Google group and Neil added a new data XML tag for storing persistent data. Maybe you can put your ID there? From reading the code seems like the id attribute was meant for internal use so it may be unreliable to reuse it.