find highlighting wrong text in page source
Even when using Safe Mode, Firefox sometimes highlights the wrong text when using "find" in the Page Source tab. The desired text is displayed white-on-white and often is off the displayed portion of the Page Source tab.
所有回复 (13)
Could be a problem with hardware acceleration or an extension.
Start Firefox in Safe Mode to check if one of the extensions ("3-bar" menu button or Tools -> Add-ons -> Extensions) or if hardware acceleration is causing the problem.
- switch to the DEFAULT theme: "3-bar" menu button or Tools -> Add-ons -> Themes
- do NOT click the "Refresh Firefox" button on the Safe Mode start window
As I said in my original post, I've already tried Safe Mode. I tried manually selecting the Default theme even though that's what I always use, but that didn't make any difference. It still highlights the wrong text. I also tried switching the default font and size, which didn't help.
Here's the page that I'm looking for "contractSymbol" in the Page Source: https://finance.yahoo.com/quote/AA/options?p=AA&date=1561680000
Seems to be working fine here. I get 92 results.
Are you using "View Page Source" in the right-click context menu or other menus (Web Developer) or do use View Selection Source (both work)?
I've tried the right-click menu>View Page Source, Tools>Web Developer>Page Source and Triple-Bar>Web Developer>Page Source all with the same results. May be it's a Windows 7 issue. That's what I'm running. To be clear, Find locates text, but what I see as highlighted is sometimes not the text that I was searching for. And, if I look around the highlighted text I can sometimes find a blank space, which when selected shows to be the sought text. Finding other text works correctly.
What does highlight all produce ?
If you mean was does Edit>Select All or Ctrl+A do, it displays all the text as white characters on a blue background. Using "find" causes the text to be displayed as white characters on a light green background. My problem is that sometimes the highlighted text is not what I was searching for.
This is about the "Highlight All" button on the Find bar to highlight all results. This uses a different background color.
If I find "contractSymbol" it finds 104 occurrences, all wrong and all highlighted in the same light green as when highlight all is OFF. Note, the data on the page is dynamic and has changed since you did the search with Highlight All.
This data seems to be part of the App.main object that you can browse with the Web Console (disable all items to get a steady display).
- App.main.context.dispatcher.stores.OptionContractsStore.contracts
Looks that this is what you are after for. I have attached some screenshots that show this object in the Web Console.
- "3-bar" menu button or Tools -> Web Developer
- https://developer.mozilla.org/en-US/Tools/Web_Console
If you want to backup/extract this data:
prompt("App.main.context.dispatcher.stores.OptionContractsStore.contracts",JSON.stringify(App.main.context.dispatcher.stores.OptionContractsStore.contracts));
(edited for the correct object)
由cor-el于
Sorry for the slow response. I was out of town. I have a data scraping program that I wrote in C++. Yahoo made a change to the option page that caused my program to miss some data. The key to finding the data I want is the label "contractSymbol", which is why I was using Firefox's "find" to locate instances of it. I was able to solve the problem in my program by manually scanning the html using "View Page Source". Still, it would be nice to know while "find" was highlighting the wrong text since a similar problem is likely to occur in the future.
My screenshot is attached for what it's worth.
I don't know what would cause highlighting to be offset from the correct location. Sometimes strange things happen that are corrected with a couple Page Up/Page Down keystrokes. (I might be confusing Firefox with MS Word on that.)
The only reasons for such an offset that I can think of are hardware acceleration and issues with a font that takes more space than Firefox calculates and thus the highlight may end up in a different position (the highlight isn't done via CSS, but is done via JavaScript).
Thanks for the screen shot. I didn't have wrapping turned on for View Source. Turning it on, fixed the problem!
Thanks again